I have the following process map (this is a simplified version of my real process map):
During the process, a message might arrive at any time signifying that the due date is changed. If the new due date is in the past, I want to terminate the entire process. If it is not in the past, then the message has no effect on the process. So I modeled this by having a non-interrupting message event receive a due date changed message. If the due date is in the past, then I throw a signal. Then another event subprocess receives the signal, perform another task, then end the process. I have an ‘end’ listener on the process so that whenever the process is killed (in the real process map, there are many ways the process can terminate), an external script is executed.
The problem I’m encountering is that the end listener is executed when the non-interrupting event throws the signal and the interrupting event subprocess catches it. The process, however, is still active as the task in the second event subprocess has not been completed (see the image). This is a huge problem because the external script should only be called when the process completes, not before!
The end listener is not called when I throw ‘terminate process’ signal via rest API, but it’s called when the non-interrupting event subprocess throws the signal. I experimented with having message events instead of signal events, or having a terminate end event instead of signal throw end event, but both produce the same problem as well.
This seems like a bug in Camunda. Why is the end listener of the process called even when the main process is active?