Hey.
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.
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.
To set the context: this project is based on
<parent>
<groupId>org.drools</groupId>
<artifactId>droolsjbpm-parent</artifactId>
<version>5.4.0.Final</version>
</parent>
using, at the moment, a local strategy for the Human Task Service (not
Mina, nor MQ) accesing the service with this class:
org.jboss.bpm.console.server.integration.TaskManagement.
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:
SyncWSHumanTaskHandler.handleCompletedTask(taskId) {
Task task = client.getTask(taskId);
...
if (task.getTaskData().getStatus() == Status.Completed)) {
...
}
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.
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).
This acquires a task and marks it as InProgress
TaskServiceSession.getTask(long) line: 527
TaskServiceSession.taskOperation(Operation, long, String, String,
ContentData, List<String>) line: 406
LocalTaskService.start(long, String) line: 276
TaskManagement.completeTask(long, Map, String) line: 95
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.
TaskServiceSession.getTask(long) line: 527
TaskServiceSession.taskOperation(Operation, long, String, String,
ContentData, List<String>) line: 406
LocalTaskService.complete(long, String, ContentData) line: 80
TaskManagement.completeTask(long, Map, String) line: 113
This acquires a Task for the work-item stuff.
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.
I think there is a conflict with the Entity Managers here...
TaskServiceSession.getTask(long) line: 527
LocalTaskService.getTask(long) line: 165
SyncWSHumanTaskHandler$TaskCompletedHandler.handleCompletedTask(long)
line: 345
SyncWSHumanTaskHandler$TaskCompletedHandler$1.run() line: 333
Thread.run() line: 662
Obviously, the best answer is how I fix this to get it working ASAP :)
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:
I see that I'm using (indirectly)
org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler that is marked as
@Deprecated.
Why is it deprecated or what should I use instead?
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?
Thanks in advance.
Marcelo.