Hey.<br><br>I'm working on a long-term government project for the implementation of BPM. We are building an application with jBPM to expose BPM to other projects as a service. I'll be working with this for a while. <br>
<br>Well, going to the point, the problem I have now is an object "Task" with stale data when I try to do a CompleteTask operation.<br><br>To set the context: this project is based on<br><br> <parent><br>
<groupId>org.drools</groupId><br> <artifactId>droolsjbpm-parent</artifactId><br> <version>5.4.0.Final</version><br> </parent><br><br>using, at the moment, a local strategy for the Human Task Service (not Mina, nor MQ) accesing the service with this class: <br>
<br>org.jboss.bpm.console.server.integration.TaskManagement.<br><br><br>By completing a task from here: TaskManagement.completeTask (taskId, data, user ID), I found the symptom of losing the assignment of task vars to the process. I don't know what exactly the problem is, but trying to solve the problem, I realized that here:<br>
<br>SyncWSHumanTaskHandler.handleCompletedTask(taskId) {<br> Task task = client.getTask(taskId);<br> ...<br> if (task.getTaskData().getStatus() == Status.Completed)) {<br> ...<br>}<br><br>the system ends up with a Task object with stale data. In the database, the task at hand has a Completed status, but in this case, the Task object has an InProgress status. So, the if-condition evaluates to false, never executing the corresponding block where lies the vars assigment stuff.<br>
<br>Here is a copy of the stack at the three moments where the completeTask operation acquires a Task object from the database (or the persistence context).<br><br>This acquires a task and marks it as InProgress<br><br> TaskServiceSession.getTask(long) line: 527 <br>
TaskServiceSession.taskOperation(Operation, long, String, String, ContentData, List<String>) line: 406 <br> LocalTaskService.start(long, String) line: 276 <br> TaskManagement.completeTask(long, Map, String) line: 95 <br>
<br>This acquires a task and marks it as Completed. I checked at this point and is the same Task Object (I mean same java Obect in memory), so far so good.<br><br> TaskServiceSession.getTask(long) line: 527 <br> TaskServiceSession.taskOperation(Operation, long, String, String, ContentData, List<String>) line: 406 <br>
LocalTaskService.complete(long, String, ContentData) line: 80 <br> TaskManagement.completeTask(long, Map, String) line: 113 <br><br>This acquires a Task for the work-item stuff. <br>This is where the problem lies. The Task object is a diferent one from the previous ones and has stale data, so the status is InProgress.<br>
I think there is a conflict with the Entity Managers here...<br><br> TaskServiceSession.getTask(long) line: 527 <br> LocalTaskService.getTask(long) line: 165 <br> SyncWSHumanTaskHandler$TaskCompletedHandler.handleCompletedTask(long) line: 345 <br>
SyncWSHumanTaskHandler$TaskCompletedHandler$1.run() line: 333 <br> Thread.run() line: 662 <br><br><br>Obviously, the best answer is how I fix this to get it working ASAP :) <br>Talking seriously, I will apreciate any tip or clue to help me focus in the right direction. Maybe I'm wrong from the root. Some of the questions that arise:<br>
I see that I'm using (indirectly) org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler that is marked as @Deprecated.<br>Why is it deprecated or what should I use instead?<br>I choose a local strategy, is still contemplated or will be removed and no one is thinking on local in favor of Mina, queues, or something else?<br>
<br><br>Thanks in advance.<br><br><br>Marcelo.<br>