How to trigger Message Catch Event, without calling the rest API provided by Camunda

I am trying to catch a message, which I created inside a service task(mqtt service task), using the below code:

`RuntimeService runtimeService=execution.getProcessEngine().getRuntimeService();			 
					.setVariable("Wow", "Vivid").correlateStartMessage();`

However when i deploy and start this process, the message is received at message received task, but it isn’t processing to the rest of the flow, unless and until, I hit the rest api: and the process variables are also not getting creating.

I worked on a similar task but with message start event, it worked, but how can i make it work with catch event.

Flow proceeds with message or any similar events when there is job created in DB and waiting for execution.
In the 2nd approach you’re doing right where message start event is waiting to execute.

In first approach after service tasks execution is completed then job is created in the DB and its started waiting from there onwards.

So need to call again with messageRef to move ahead with the flow.

Hi @Alok0305
How can I do that, I referred to this thread, looks like he was able to do it, without any call again.

Yes the referenced implementation about can we have intermediate (message) catch event for that yes we can have.

But if I understood correctly your query is about how to proceed with process flow in case of intermediate message catch event. For that, when intermediate message catching event is reached and waiting there, at that point of time you can opt from below option:

  1. Intermediate message throw event in case of BPMN (with the same name as catching message ofcourse; same as your 2nd approach in original post)
  2. Rest (engine-rest/message) call in case of WS
  3. By using Message correlation API if using Java code

As given in the document “When a token arrives at the message intermediate catching event it will wait there until a message with the proper name arrives”.

1 Like

Hi @Alok0305

So i tried using throw and catch intermediate, and I am calling java service inside my throw event, however, inside that class i am trying to create a process variable, using below java code.

runtimeService.createMessageCorrelation("messengerOfGod").setVariable("wow", "Vivida vi loca").correlateStartMessage();

But this gives me an error:
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message 'messengerOfGod': No process definition matches the parameters

Tried setting on Asynchronous Before for throw event, didn’t help.

Hi @Alok0305,

I am keeping the same message name for throw event similar to my catch event.

But still the execution is stopping at my catch event.

Can you brief about the use case you re trying to achieve?

Here when your service task is trying to correlate the message that point of time no intermediate catching event is waiting with message name “messengerOfGod”.

and when its reaching to intermediate catch event, no one is there to correlate the msg.

Hope you understood.

I usually use REST API for this purpose (see but why you use correlateStartMessage() instead of correlate() ? First one send signal to start new process instance which is not your case. Later send information to all process who listen for a given message