Multi Instance Compensation

Hi guys,

I have a question regarding compensation in multi instance scenario. See my attached process model

Lets assume I have two instances of multi instance sub process which are waiting at “Wait for something” message event.
No lets assume “Cancel” message event is thrown . Will “Do something” be compensated for both instances of multi instance scenario or not? WIll “Compensate” SendTask be executed or not?

I found this in documentation

Note: When compensation is thrown for a multi instance activity, the associated compensation handler is only executed when all instances of this activity have ended. That means, the multi instance activity must be ended before it can be compensated.

So I assume that “Compensate” SendTask would be called two times in my scenario but
my test tells an other story. Am I wrong with my assumption?

Thanks and best regards ,

Markus

Interestingly - because the message event interrupts the sub process this meas that the subprocess did not complete successfully. SO if it didn’t complete, the compensation event will not look inside it’s scope to see if there are any compensation tasks to run. Because it will only try to compensate completed activities any internal scopes that are also complete.

Hope that makes sense.

Hi @Niall

I understand why it not works. Im not really sure if it makes sense. Therefore I am missing some technical insides of the engine. In my opinion in a perfect world compensation would also look inside scope of interrupted but partly executed sub processes but I am not sure.

Some other question. Do you have an idea for a workaround? :wink:
I did this:

but I can not leave my multi instance subprocess by boundary event in this solution. Any other idea?

Best regards and thanks,

Markus

Hi @Niall

I run in problems during test with my workaround.
In my solution I really have a problem if multi instance sub process is “multi instance async before”.
Because signal catch event will maybe not be active when cancel message event is correlated, process instance will not end.

I will run in an inconsistent state.

Any idea?

Best regards

Markus

Maybe I have to clearify my goal.
I want to be able to cancel process instance every time via event sub process and compensate all relevant tasks of multi instance process. I want to go further in process via event sub process.
So I tried this:


I thougt that “End cancel” event is only reached when all “Compensate” Compensation End Events in inner event sub process where reached because signal event is thrown synchronously.

In the default configuration, the signal is delivered synchronously. This means that the throwing process instance waits until the signal is delivered to all catching process instances. The catching process instances are also notified in the same transaction as the throwing process instance, which means that if one of the notified instances produces a technical error (throws an exception), all involved instances fail.

So I made Compensate End Events in inner event sub process async after to follow my outer sub process path.
But this does also not work.

It seems that all catching process instances of signal are notified but not executed before “End Cancel” is reached.

Maybe I missed something?

Best regards,

Markus