Correlation in camunda 7

Hi there, i have a question regarding the correlation message event.
So i have created two process definitions. One process definition has a message intermediat event where all my Instances wait to be correlated. In the second process definition I have a Service Task where i want to correlate a pspecific process instance. Something like: runtimeService.createMessageCorrelation(“AufrufMessage”)
.processInstanceId("instnce id ")
.processDefinition("definition id ")
.correlate();
I cant seem to get it right. Can you actually do something like this?

Thank you :slight_smile:

Hi @Teodora, yes, it is possible to constrain the message correlation to a specific process instance id - this is based on my reading of the Camunda 7 API docs.

https://docs.camunda.org/rest/camunda-bpm-platform/7.21/#tag/Message/operation/deliverMessage

Setting the process definition on the fluent builder returned by createMessageCorrelation is not valid (on 7.21). And anyway, by specifying the process instance ID it would be redundant (as a process instance can only be created from a single process definition)

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.3/org/camunda/bpm/engine/runtime/MessageCorrelationBuilder.html

I hope that helps!

1 Like

Hi @herrier cool. It works. Thank you for the help

1 Like

Just for the record: process definition id is not the same as the process model key. Definition id is an unreadable value which is randomly generated when a process model is deployed. That was probably the reason why your correlation didn’t work.

As @herrier wrote, process instance Id as the correlation condition should be enough.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.