Programatically way to throw compensation events

Hi,
Is it possible to programatically throw a compensation event over a processInstance before calling runtimeService.deleteProcessInstance(…) ?
I would like to have the option of removing a processInstance but previously have all compensation tasks executed…
I’m looking for a call similar to

  • runtimeService.correlateMessage(…)…correlate()
  • runtimeService.createSignalEvent(…)…send()
    Or a way to tell runtimeService.deleteProcessInstance(…) to throw compensation events if there is any boundary event or compensation event subprocess awaiting.

Hi @mabertran,

you can’t trigger the compensation via Java Code. You have to use an Intermediate Throwing Compensation Event or a Compensation End Event.

You may add a message catch event in your process which throws the compensation event. Then, you can trigger this message event via Message Correlation.

Does this help you?

Best regards,
Philipp

Yes, this clarifies the issue. Thanks a lot.
In the other hand I have to say I’d prefer the deleteInstance(…) java call to throw the compensation event or at least be able to throw a compensation event directly instead of a message event that throws a compensation event.