Message events are events which reference a message. They can be used to wait until a proper message is received.
Currently, messages can be published only externally using one of the Zeebe clients.
A message can be referenced by one or more message events. 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 message event is entered and extracts the value from the workflow instance payload. The value must be a string. If the correlation key can't be resolved or it is not a string then an incident is created.
<bpmn:message id="Message_1iz5qtq" name="Money collected"> <bpmn:extensionElements> <zeebe:subscription correlationKey="$.orderId" /> </bpmn:extensionElements> </bpmn:message>
Message Intermediate Catch Events
When a token arrives at the message intermediate catch event, 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 event is left.
<bpmn:intermediateCatchEvent id="money-collected"> <bpmn:messageEventDefinition messageRef="Message_1iz5qtq" /> </bpmn:intermediateCatchEvent>
Receive tasks are an alternative to message intermediate catch events.
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 intermediate catch event.
<bpmn:intermediateCatchEvent id="money-collected"> <bpmn:extensionElements> <zeebe:ioMapping> <zeebe:output source="$.price" target="$.totalPrice"/> </zeebe:ioMapping> </bpmn:extensionElements> </bpmn:intermediateCatchEvent>