@ilyabr Implementation must be provided for both activity types(intermediate message throw event & send task).
When it comes to configuring message, intermediate throw event allows to configure the message name (can be called as named message) while modeling the bpmn, but in the send task, one must need to explicitly correlate the message name.
A Send Task is used to send a message. In Camunda this is done by calling Java code.
<sendTask id="sendTask" camunda:class="org.camunda.bpm.MySendTaskDelegate" />
Message Intermediate Throwing event sends a message to an external service. This event has the same behavior as a Send Task.
<intermediateThrowEvent id="message">
<messageEventDefinition camunda:class="org.camunda.bpm.MyMessageServiceDelegate" />
</intermediateThrowEvent>
To correlate the message to the specific process instance waiting for it by matching some properties of the incoming message to some properties of your process instance:
runtimeService
.createMessageCorrelation("myMessage")
.processInstanceBusinessKey(myMessage.getOrderId().toString())
.processInstanceVariableEquals("customerId", myMessage.getCustomerId())
.correlate();
- A process instance matches if it is waiting for a message named myMessage, …
- if it carries the orderId of the message as its business key , …
- and if a process variable “customerId” also matches the expectations.
There are other differences can be read from,