From Camunda Modeler, a Message Intermediate Catching Event only can define a message name. How I can define the correlation key associated with this message too? So I can use REST API to only send message to this Message Intermediate Catching Event with the correlation key.
Camunda document mentioned can use runtimeService. But I do not know how to use it in Camunda Modeler.
You only need to add the message name in design time.
In runtime when you start the process you can give it variables or a business key that can then be used to correlate the message.
I have come across the same problem. Could you elaborate on how to specify a correlation key in a process instance upon its start? I cannot see it anywhere in the documentation.
I figured it out. To publish a message, one must call:
POST /message
specifying a message name in the body, a business key, and a process instance ID. The last two parameters are optional. Open questions are: a) is there a way to specify TTL for a message, like in Zeebe? b) if a process instance ID is omitted, will the message be delivered to all process instances (even originated from a different process definition)?
Such a great post, thank you in advance for your proper reply.
We have found the post according to our requirement. Actually, we need a module for sending any kind of message to the Engine (from External Task) and it seems we could prepare it according to your suggestion ( use Rest API for POST /message).
It’s our pleasure if we could prepare this method too (if you think its necessary for External Task Client)
The module could be like the below code (in ExternalTaskService.java interface).
/**
* Send Message
*
* @param message which message string that you need to send to engine
* @param correlationKeys indicates the master keys for correlation.
* @param processVariables provides related variables to the process.
* @param all specifies which params should be send (all or not).
*
* @throws NotFoundException if the task has been canceled and therefore does not exist anymore
* @throws NotAcquiredException if the task's most recent lock could not be acquired
* @throws ConnectionLostException if the connection could not be established
* @throws ValueMapperException
* <ul>
* <li> if an object cannot be serialized
* <li> if no 'objectTypeName' is provided for non-null value
* <li> if value is of type abstract
* <li> if no suitable serializer could be found
* </ul>
*/
void sendMessage(ExternalTask externalTask, String message, VariableMap correlationKeys, VariableMap processVariables, Boolean all);