I’m modelling a process with two main steps. The first step (Choose options Task) prepares data for the second (Fill Forms Transaction) step. The process is being executed by embedded engine within Spring Boot app with own UI. When the process is in any place in the 2nd step (Fill Forms) user can cancel the step and go back to the first one (Choose options).
The basic approach was to attach Signal boundary event to the Fill Forms Transaction going back to Choose options Task. The signal was sent from the spring boot app to the main process id and it worked however there was no compensation.
Now I want to have compensation tasks for Save A & Save B tasks and I can’t quite model it.
I’ve tried to add Event subprocess with Start signal and compensation throw event. It works in a way:
it runs compensation tasks for completed Save A/ Save B task [GOOD]
it ends the whole process without going back to Choose Options [BAD]
I can’t send the signal to main process Id. I managed to overcome it by sending signal without an executionId, but I guess this way it could trigger the signal for all processes of this type, so it’s just for testing. [BAD]
Want I want to achieve:
A way to send an event from Spring Boot app to the given process which would run compensation for all completed tasks of the Fill forms transaction and the process goes back to Choose Options task.
The example process it simplified; there can be many more steps within the transactions and the transaction could be canceled any time (if it’s not completed yet) by the user.
The modeler doesn’t allow you to model a cancellation event inside an event subprocess. So you could try to eliminate the transaction subprocess, and in your event subprocess receive an event, throw the compensation and then throw an escalation.
Regarding the fact that you can’t signal from the main process execution, why don’t you use a message? It is way more decoupled than having to pass the execution to the signal. You could use the business key to correlate that message. For 1-1 communication, message is the way to go. Any reasons why you would need to use a signal?
Thanks Lucas. I know the page, I have Real-Life BPMN book (3d edition) and also watched a bunch of Niall Deehan videos. I was pretty sure that the Cancel event is the way to go and I feel it’s most appropriate semnatics wise.
The message works like a charm and it triggers the event subprocess easily! Thanks!
The escalation event also works as expected, so I can say I have a working solution.
I’ve also tried the cancel boundary event and compensation end event triggered with a message.
Compensation works of course, but the cancel boundary event does not.