[jboss-user] [jBPM] - How to automatically claim a human task after process start

Travers Snyman do-not-reply at jboss.com
Mon Dec 3 06:39:14 EST 2012

Travers Snyman [https://community.jboss.org/people/tsnyman] created the discussion

"How to automatically claim a human task after process start"

To view the discussion, visit: https://community.jboss.org/message/779600#779600

We have recently upgraded to JBPM 5.4 and have come up with an interesting situation.

When we start a process, the next node is a human task and we need to claim the task automatically by the user that created the process. This used to work in version 5.3, but in version 4 it seems that we try to claim the task before the task server (in our case Mina task server) has actually created the human task. The code snippet involved is something like the following

ProcessInstance processInstance = knowledgeSession.startProcess(processName, params);
BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();
taskClient.getTasksAssignedAsPotentialOwner(userId, "en-uk", responseHandler);
List<TaskSummary> tasks = responseHandler.getResults() ;
if (!tasks.isEmpty()) {
   TaskSummary taskSummary = tasks.get(0);
    Long tasId = taskSummary.getId();
    BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
    taskClient.claim(taskId, userId, responseHandler);

If I put in a manual delay just after the process is started, it works correctly, so it looks like I need some signal from the task server that the task is created before looking it up and claiming it with
getTasksAssignedAsPotentialOwner but thus far I have been unable to find a way to do this.

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121203/3f379e34/attachment-0001.html 

More information about the jboss-user mailing list