This operation delivers a message to a process instance using administrative access. Use it when an administrative script needs to correlate a message with a waiting process instance.
The base request is:
receive(receiveMessagePayload)
The following example delivers a message using a message name and correlation key:
new RuntimeProcessInstanceAdminService()
.receive({
name: variables.messageName,
correlationKey: variables.businessKey
});
Use ReceiveMessagePayload when a script needs to deliver a BPMN message to a waiting process instance.
The following example defines a message with variables:
const receiveMessagePayload = {
name: 'updateStatus',
correlationKey: variables.businessKey,
variables: {
status: 'SHIPPED'
}
};
new RuntimeProcessInstanceAdminService()
.receive(receiveMessagePayload);
In this example:
- name: 'updateStatus' specifies the message to deliver.
- correlationKey: variables.businessKey provides the value used to correlate the message with a process instance.
- variables provides data with the message. In this example, the status variable is set to SHIPPED.
- receive(receiveMessagePayload) delivers the message using the specified payload.