Hi Phillip,
You are right, the process is a bit difficult to explain. I created a model and unit test to show the behaviour I would have liked:
https://github.com/jhorstmann/camunda-engine-unittest/blob/compensation-in-subprocess/src/test/resources/testProcess.png
https://github.com/jhorstmann/camunda-engine-unittest/blob/compensation-in-subprocess/src/test/java/org/camunda/bpm/unittest/SimpleTestCase.java#L76
In the real process there are some more tasks inside the subprocess, and the process should be cancelable using a message correlation while theses tasks are executing.
> compensation will only trigger activities "at the same level of sub process" (and then be propagated inside in case these are subprocesses themselves)
This would explain the behaviour I'm seeing, since I'm triggering compensation outside the subprocess.
I will try doing the same using an event subprocess.
Thanks,
Jörn
Am Donnerstag, 28. Januar 2016 10:29:53 UTC+1 schrieb Philipp Ossler:
> Hi Jörn,
>
>
> I don't understand your issue exactly. Can you please provide a BPMN that shows your use case.
>
>
> Assuming that your process looks like this:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> In case the task b is active, if the task c throws an error then an compensation event is thrown which can not be catch from the compensation handler on task a because the subprocess is not completed yet. Generally, BPMN defined comensation is a way:compensation will only trigger activities "at the same level of sub process" (and then be propagated inside in case these are subprocesses themselves)you can only compensate activities which are completed. If an Activity is still active, it cannot be compensated but rather needs to be canceled.