0 Replies Latest reply on Dec 3, 2012 6:39 AM by Travers Snyman

    How to automatically claim a human task after process start

    Travers Snyman Newbie

      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.