Implementing Messages externally in Camunda 8.6

Hi @Niall,

I’m currently using Camunda 8 (version 8.6) as the primary BPMN tool for our final year modules. I’m trying to implement message passing from an external worker using the Zeebe Java Client (via the Zeebe Factory pattern to obtain the client instance). However, I’m facing an issue where the message appears to be sent successfully from the worker, but it is not being picked up by the message catch event in the BPMN process.

try (ZeebeClient zeebeClient = ZeebeClientFactory.getZeebeClient()) {
System.out.println(“Test Started 2”);
zeebeClient
.newPublishMessageCommand()
.messageName(“test_message_name”)
.correlationKey(“key_message_1”)
.send()
.join();

System.out.println("Test Started 3");

}

The message gets sent without throwing any exceptions, and I can see the logs, but it seems the message catch event in my BPMN model is not triggered.

I’ve attached screenshots of the BPMN model and message implementation for reference (not shown here – can share if needed).

Has anyone encountered a similar issue, or could advise on what might be going wrong? Any tips on debugging message correlation in Camunda 8 would also be appreciated.

Thanks in advance!


Hi @DilshanJay
Do you have a process instance waiting to receive the message event?
A token needs to be waiting on the receive event for it to be triggered

I might be wrong, but it looks like the correlation key in your BPMN is pointing to a process variable key_message_1, while in your worker, it is a string “key_message_1”

If the variable in your process instance isn’t equal to “key_message_1” then it won’t correlate.

To see if this is the problem, try setting the BPMN Correlation Key to the string “key_message_1” (for one run). Usually this value should be a unique value for each instance of the process (eg. a Business Key like “Invoice Number” or “Applicant Number”) and both your worker and your process know this reference number.

Think of it almost like email…

To: < invoiceNumber > at InvoiceProcess.BPMN  (this is CorrelationKey)
Subject: Shipment Received
Body: The items received for this Invoice are:  1 of Item 1

So… your InvoiceProcess would be looking for the messages coming in with Subject “Shipment Received” and would send them to the appropriate Invoice based on the “To” (CorrelationKey)

In your case, it looks like your Message Catch is configured to look for:

To: < key_message_1 > at T2.BPMN
Subject: test_message_name

while your send is configured to pass:

To: key_message_1 at T2.BPMN
Subject: test_message_name
2 Likes