Intermediate Message Event not working

Hi

I have modeled an Main process with single activity and Event sub process (child process) with intermediate message event receiving message.

I am able to kick-start the process instance, but could not trigger intermediate message event inside the event sub-process. I am using below Java API to trigger the message. First I am trying to query execution object using createExecutionQuery() [But it returns null always] and invoking message on intermediate message event, using runtimeService,messasgeEventReceived(eventMessageName, executionID);
Execution execution = runtimeService.createExecutionQuery()
.processInstanceId(processInstanceID)
.messageEventSubscriptionName(“childMessageEventRef”)
.singleResult();
if (execution != null) {
System.out.println("Execution ID ::: " + execution.getId());
runtimeService.messageEventReceived(“childMessageEventRef”, execution.getId());
}

Please can you help achieve this functionality.

Process Diagram

IntermediateMessageEvent.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>

Thanks

Hi,

You can’t use an intermediate catch event as the starting point for an event sub process. Instead, use a message start event and then it should work as expected.

Best regards,

Tijs

Thanks tijs.

I have changed to start message event and It is working as expected now.

hello there
just want to know that whether messageEventSubscriptionName is the same thing as the messageRef?

No need to crosspost (Finding executions waiting for messages based on process variable matches - #7 by joram)

Hi,

I have tried this flow of invoking the event subprocess. It works but as soon the eventsubprocess is invoked the parent process i.e parent process user task gets completed automatically.

Can some one please guide on how to achieve the below flow

  1. Invoke the event sub process from the parent process
    2.the control should move to event subprocess. As soon as the event subprocess user task is complete dthe flow control should move back to the main process.
  2. the main process tasks should be allowed to be completed then