Need External Worker to send intermediate throw message

Team,

I am creating an Intermediate throw message event as shown below.

I have created the messagename for corelation and have mapped them to the intermediate catch message events as well.
However, I need to perform the Implementation for the throw message via External worker but finding it difficult to figure out which API can I use to send the message.
Could you help with some examples.

Thanks in advance.

Hello my dear!

I use it more or less like this!

         execution.getProcessEngineServices().getRuntimeService()
         .createMessageCorrelation("YourMessageCorrelationName")
         .processInstanceId("YourProcessInstanceID").correlate();

Hope this helps.
If this helps you, leave your like hahaha and mark it as Solution for other users to know that your case has been resolved.

Big hug!
See Ya!

William Robert Alves

You should either model the message OR implement in the worker, not both.

Reason being is that if you do both, you should expect both message throws to happen.
From a process clarity perspective, modeling it makes it clear to the process reader that there will be a message thrown. If the message is implemented in the worker and is not modeled, then people reading the process have no way to know that there’s a message sent… which leads to questions about the process that receives it (“Ok, but WHEN / WHERE does it get thrown”)

The way your process is designed, the messages will be thrown multiple times, since it’s inside a multi-instance block. Is that what you intend to do?

Hi @Saju_John_Sebastian1,

If Spring Boot Starter for External Task Client is used then a good option is to use Camunda REST Client for Java Spring from within your external task implementation to interact with the process engine (Example: Doing message correlation).

Well this works if I opt for Java class implementation in the Modeller.
My requirement is to use the “External” option in the “Implementation” section by providing a “Topic”.
In the External class, I don’t have a way to call getProcessEngineService() Api.

Is there any way I can access simillar API to send message as shown in your response.

Yes. I will need to have multiple instances of messages to be send and hence the multi-instance.
I did some changes in the bpmn as shown here.

The Boundary Message Intermediate Catch is configured as below:

My intention is to Throw the intermediate message event from the multi-instance process, which will be caught by the non interrupting Boundary event.
The issue is I am unable to SEND this message from External Worker.

Any thoughts?

This is not valid in BPMN.
You cannot throw a message to the same process instance.

As @hassang indicated, from a fully external worker, use the REST API to send the message.

1 Like

Thanks @hassang , @GotnOGuts for the response.
That clears the doubt.

1 Like