Search code examples
jbossdroolsjbpm

Processing a task in an Asynchronous Workitemhandler


I read in a jbpm forum article https://community.jboss.org/thread/165545 describing the HumanTaskHandler as Asynchronous workitem handler and when we are using an asynchronous humantask handler we have to complete any task with taskclient.complete() and then signal the process engine with ksession.getWorkItemManager().completeWorkItem().

Is this an ideal approach to complete a task while using asynchronous workitemhandler.?
This is like completing a task twice. Actually whats happening when we call complete() and completeWorkItem().?
Kindly clarify.


Solution

  • If you have everything set up correctly when you call the taskClient.complete() method the session will notified and the ksession.getWorkItemManager().completeWorkItem() will be called automatically for you. There is no need to call it by yourself. You only need to remember to register the WorkItemHandler to the session and keep the session alive so it can be notified. Cheers