Best way to rollback business DB transcaction if process fails

Hi everyone.
I was wondering what should be the best and most elegant way to rollback transactions made in the business database if the camunda process fails.

My setup: Camunda runs as a standalone client and communicates with the spring application through rest api.

I have a process that has a lot of service tasks, that are implemented as external workers in the spring application. Some of these external tasks make modification on the database. I was wondering what would be the best solution to rollback these database modification if the the process fails at some point?

Currently I have compensation tasks that will be triggered in case of Cancel End event. These compensation tasks basically make new modifications on the database to revert what the original service task modified. To get back to the original state. I was wondering if its somehow possible to have one transaction through the entire process and if something fails then rollback this transaction.

Thanks in advance for any input or ideas.
Sz

Hello @sznemeth ,

when orchestrating external workers, the pattern you are using is perfect.

The alternative approach would only work if you had Java Delegates and would only use one transaction to run through the whole process.

I hope this helps

Jonathan

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.