2 Replies Latest reply on Oct 14, 2016 5:31 AM by Muthu Subramanian

    Exception Handling in JBPM workflow - EAP 6.4, BPMSuite - 6.3

    Muthu Subramanian Newbie

      We have a requirement where, if a Service Task or a Custom Task (associated work item handler) fails, the task should be retried and if unsuccessful after certain number of retires, the workflow need to be mapped to a user task for human intervention.  The user would typically fix the issue and will retry the job (failed task) in which case the workflow will complete. Not necessarily it should be a user task; the idea is to put the workflow in a persistent quiescent state, so it could be recovered from the point of failure.


      In brief, the requirement is that the workflow should never abort in case of any Exceptions and should be put in a persistent quiescent state for human intervention and the failed step need to be retried.


      Is there any elegant way to implement this Exception handling requirement? Based on the red hat documentation, the Exception handling involves catching the error, signals and handling it in a sub-process and there doesn’t seem to be any straight forward way of persisting the state, allow human intervention and then retry from the point of failure


      I could replace the Service Task in the main workflow with a callable activity mapped to a sub-process which will have the Service task and on failure, I could catch the exception, retry, map to user task and on completion the control will come back to the main workflow.  But, this will result in a sub-process for every single service, custom task and I'm sure, there is a better way to implement this Exception Handling requirement. Any help is much appreciated

        • 1. Re: Exception Handling in JBPM workflow - EAP 6.4, BPMSuite - 6.3
          Dan Bu Newbie



          have a look at Async WorkItemHandlers.

          Chapter 24. Concurrency and asynchronous execution Chapter

 WorkItemHandler backed with jbpm executor


          You can configure the amount of retries and delays and it works simular to the quartz scheduler.

          Also have a look at the Class org.jbpm.executor.impl.wih.AsyncWorkItemHandler in jbpm-executor.



          • 2. Re: Exception Handling in JBPM workflow - EAP 6.4, BPMSuite - 6.3
            Muthu Subramanian Newbie

            Hi Dan,


            Thank you very much.


            I tried using it. Though it offers the ability to retry, doesn't give the ability to put the workflow in a wait state, like a user task. Though I could achieve it via the BPMN modelling, but attaching an exception process/loop to every Service task or Custom Task seems too much. Is there a better/elegant way to achieve it?


            I'm also having issues with the AsyncWorkItemHandler. In our case, we use the REMOTE CLIENT and the WIH are initialized from the deployment descriptor as below. But, this doesn't seem to work. I'm getting some crazy LinkageError



                  <identifier>new org.jbpm.executor.impl.wih.AsyncWorkItemHandler(org.jbpm.executor.ExecutorServiceFactory.newExecutorService(), "org.jbpm.executor.commands.PrintOutCommand")</identifier>





            Even if this works, not sure how the Executor Service will be shutdown? After the callback the Executor service doesn't seem to be cleaned up and the remote client wouldn't have the ability to do it either. So, how to cleanup the executor service after either OnDone or OnError?


            Thank you,