Programmatically trigger boundary event

I’m stuck with a very basic scenario:

  • User task “A” is a part of a subprocess “B”
  • “B” has an interrupting boundary message event attached to it
  • I’d like to programmatically trigger this boundary event on “B” from the execution listener defined on “A”

The Execution handler is looking like this:

public class SendTestMessage implements ExecutionListener {
	public void notify(DelegateExecution execution) throws Exception {
		execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("TestMessage")
				.processInstanceId(execution.getProcessInstanceId()).correlate();
	}
}

Which produces this error:

Execution with id '539dd431-2ee9-11e8-9290-0242c48c6219' does not have a subscription to a message event with name 'TestMessage': eventSubscriptions is empty

Surprisingly, I can’t find a good example for this basic thing. What am I missing?

Hi Michael,

Could you please share an example of your process.

Best regards,
Yana

Hi Yana, in a very minimal sample I created it seems to work fine. I’m uploading it just in case it will be useful for someone else here. In the real process I implemented a workaround by replacing the message event with a conditional event, and it’s working fine. Thanks.
ab.bpmn (7.6 KB)