Search code examples
javaactivitibpmn

How to handle exception state in activiti bpmn


How activiti handles the exception state? If error occurs in any of the task how the flow will move back to a step from where the task can be re executed again?


Solution

  • There are a couple of answers to this question. If the task is a java or script task and is running synchronously, then resumption of a failed instance (usually caused by a technical exception) with be from the last persisted state (remember, a BPM engine is really just a state machine).

    Now, you can (obviously) add exception handlers (especially in 5.15 which introduces event handlers) for a specific task or for the process instance as a whole. These exception handler allow you to control transaction rollback (depends on the transaction manager you are using).

    Finally, you can bubble a bpmnEvent up to the process model and handle exceptions/compensation using an attached/boundary event handler in the BPMN model.

    Hope this helps. Greg Harley.