Concurrent message processing

I have a question regarding message processing.

Let’s say I have a BPMN process that has multiple “stages” (stage 1 and stage 2). Each stage commences when a certain external message is received. So something like this:

In my case this would be a message published via the Camunda Java API by a component listening on a message queue. What happens if the messages for let’s say “message1” and “message2” arrive with few milliseconds in between, and the process is still processing stage 1 - so messages are in order, they are just happening fast. Is the message2 then lost and the process will stop at the waiting point? If this is the case what could be done about it (e.g. have the event publisher single threaded and wait till the process engine has settled in a stable state)?

Thanks for clarifying.

Hi Sebastian,

Welcome to the forum… Yes you can have a race condition between messages arriving and the process waiting at a receive message event.

There are a number of ways to deal with this;
Implement a dwell and retry mechanism in your message delivery.
Use a message message buffer plugin like this one.
Modify your process model to concurrently receive either event and use conditional events to serialize process semantics - eg in your model Stage 2 must have stage 1 complete and receipt of message 2



1 Like

Thanks for the clarification!