I have the following scenario where the compensation task has to executed after error thrown. In my case there are not getting executed as it is in a transaction subprocess which is not COMPLETE yet. Any help?
I understood in the docs that (waitForCompletion=false) this is not yet supported. Is there any other alternative where I can achieve this? Or any updates when it will be supported in Camunda BPMN?
There is no need to use a transaction sub process. in fact it doesn’t work if you do - because unless the sub process is successfully completed completely then it will not run any compensations in it. So instead you need to use an event sub process:
Thanks alot for the quick response. Yes I did the same thing (created a error start event). But I have an end listener at the of transaction sub process which adds some mandatory attributes to the execution variables. Those variables are supposed to be added at the end of transaction only. Is there any way?
yea. so if I use waitForCompletion=False I would be able to execute compensation events (in case of failure) with the listeners which has to be executed at end of the process (in case of success).
Instead of putting the listener at the end of the sub process - if you want to have a listener run when the process ends - no matter if the sub process finishes or not, then you should attach the listener to the process level, not the sub process level.