Receive Task : Modelling multiple messages in the same receive task

Hello ,

Referring to : Multi-instance | Camunda 8 Docs
Wondering if its possible to model multiple messages for the same receive task?
For e.g. Message = “Order”+awaitingAction
Is it possible to model such that, the receive task can receive any of this messages at the run time :

  1. Order Modified
  2. Order Completed
    etc.

If yes, then how can it be achieved? I don’t see any way to do it , refer picture please.

Sure,
You just need to add a multi-instance marker on the task. Then you can add the local item for each instance as part of the subscription. Something like this should work:

MultipleItems

2 Likes

Niall’s solution will work if you’re after the behaviour that all messages must arrive before continuing after the receive task. If you mean “either message will complete the receive task”, I don’t think there’s a way to do that, because each instance of the task is subscribed to exactly one type of message and correlation key.

If you need that behaviour, you could use an event-based gateway instead (even though this is a bit unnatural because both message events would lead to the exact same flow to continue on). Or, if you’re using custom glue code when the message arrives (however that happens in your case), outside of the process engine, you could simply send the same message to Zeebe for both types of message you want to support. This would require only a single subscription from the receive task.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.