Receive Tasks

Receive tasks are tasks which references a message. They can be used to wait until a proper message is received.

Messages

A message can be referenced by one or more receive tasks. It holds the information which is used for the message correlation. The required attributes are

  • the name of the message
  • the correlation key

The correlation key is specified as JSON Path expression. It is evaluated when the receive task is entered and extracts the value from the workflow instance payload. The value must be either a string or a number.

XML representation:

<bpmn:message id="Message_1iz5qtq" name="Money collected">
   <bpmn:extensionElements>
     <zeebe:subscription correlationKey="$.orderId" />
   </bpmn:extensionElements>
</bpmn:message>

Receive Tasks

Receive Tasks

When a token arrives at the receive task, it will wait there until a proper message is correlated. The correlation to the event is based on the name of the message and the correlation key. When a message is correlated then its payload is merged into the workflow instance payload and the task is left.

Read more about message correlation.

XML representation:

<bpmn:receiveTask id="money-collected" name="Money collected" messageRef="Message_1iz5qtq">
</bpmn:receiveTask>

Message intermediate catch events are an alternative to receive tasks.

Payload Mapping

By default, the complete message payload is merged into the workflow instance payload. This behavior can be customized by defining an output mapping at the receive task. See the Input/Output Mappings section for details on this concept.

XML representation:

<bpmn:receiveTask id="money-collected" name="Money collected" messageRef="Message_1iz5qtq">
    <bpmn:extensionElements>
    <zeebe:ioMapping>
      <zeebe:output source="$.price" target="$.totalPrice"/>
     </zeebe:ioMapping>
  </bpmn:extensionElements>
</bpmn:receiveTask>