cancel
Showing results for 
Search instead for 
Did you mean: 

Everything is Reverted on Error!!!

flexicoder
Champ in-the-making
Champ in-the-making
Hi,

Consider the following sequential process:
1- start
2- user task: user confirmation
3- service task: transferring 1000$ to another bank account
4- service/script task: send an email to the user (bugus)
5- user task: user notification
6- finish

Assume that there is a small bug in the task of step 4 (sending email).
Now, when the user clicks the "confirm" button in step 2, the activiti engine performs the step 3 and transfers the 1000$, then it tries to run the step 4 and fails.
The bad thing is that the activiti engine reverts its internal state to step 2, but the money is gone!!!
How can we prevent the activiti engine from going back?
Or, is there a work-around by modifying the bpmn process with some kind of error handling?

1 REPLY 1

trademak
Star Contributor
Star Contributor
Of course there are good ways to implement this kind of behaviour.
You can make the step 4 an async task. This means that it will try to execute the logic in a asynchronous job. When it fails it will retry 2 times and then the job will be in a failed state and the process state will be in step 4. You can also implement error handling in the logic of step 4 and handle the error there or create a BpmnError that you can catch in an error boundary event.

Best regards,