Handling: "Termination possible until a task is reached "-situation

Hello,

i am looking for a handy approach to handle the following situation:
Let’s assume i have a process with some tasks. From the beginning of the process it is possible to terminate it by receiving a cancel-message until some task is reached. When the task is reached, i want to be sure, that the process instance can not be canceled anymore. Currently i am modelling that in this way:

Note: I don’t want to attach a message cancel incoming event on each task. This will be dirty.

At the beginning of the process i am using the event based gateway in order to wait for cancel or signal event. If some state in the instance is reached it should not be possible anymore to terminate this instance.

  1. How would you handle such a situation? Is there a cleaner way?
  2. What appens to subproces-instances? Are they canceled, too? That would be nice
  3. Assuming i have defined some attatched compensation tasks and i want them to be executed before termination: I would just put a compnsation intermediate throw event between the incoming cancel message and the terminate task.
  4. Assuming situation 3) but i also have attached compensation events inside subprocesses. Are the compensations done also in the subprocesses or only in parent process? If not how can i archieve that?
  5. Is it possible to terminate an instance from the java api? (for me it is okay, that the process instance will be deleted from history) - i saw the runtimeService provides adeleteProcessinstance method.

I would be really glad for your help.

Thanks a lot!
Andy

Hi Andy,

you can also model your process in a way like this:

Or with compensation handlers:

Please have a look at the reference guide for more information about compensation events.

Does this help you?

Best regards,
Philipp

1 Like

Ah great, that is a clean way, also without terminate event. Thank you :slight_smile: