I have started different process using startProcessInstance(processdefinitionKey, businessKey).
When I tried to send a message to a specific instance of one definition, I can only specify the businessKey but not the processdefinitionKey.
I can try query for processInstance and correlateMessage with corresponding processInsanceId.
But that means I need to query whenever I try to correlate.
Any better suggestions? Or I misunderstand some process?
Hi @singlash,
You can correlate message on both values business key and process instance variable.
processInstanceVariableEquals
Could you elaborate on this? processDefinitionKey is not a variable.
When I query, I can do runtimeService.createProcessInstanceQuery().processDefinitionKey().processBusinessKey().singleResult();
but simmilar thing cannot be done with messagecorrelation.
Hi @singlash,
Yes, you can’t correlate on process definition key so as a workaround solution you can use a process instance variable to hold the value of process definition key and then correlate on both values business key and process instance variable.
Hi @singlash,
messages in BPMN are used for communication between different process models. They should be independent from the process defintions.
A possible way to enforce this could be a naming convention to include a pre- or postfix with the process definition key (or a shorcut) in the message name.
But usually it works without this.
Hope this helps, Ingo
The thing I want to achieve is sending the same message in the same function. Based on the definitionKey, they go to the different process definitions and execute corresponding tasks.
So businessKey should be unique even if they are in different process definitions?
got it. Thanks!