I am just working on converting an existing flow from camunda 7 to 8 and having a few issues with variables in event subprocesses.
Previously in Camunda 7 in order to get the variables from the message correlation into the correct scope I would have added a execution listener onto the message start event as below
${execution.setVariableLocal(‘MESSAGE_IN’, MESSAGE_IN)}
We did this because we can have many messages coming in at once and so need the variable at the local scope for the event subprocess.
With camunda 8 I have not been able to get similar behaviour. The closest I got was adding an output on the message start event but that only seemed to give the variable on the start event and not the event subprocess level.
@jwulf I’ve created an example in camunda 7 as to what I am trying to achieve so that when a message is received the event subprocess will have the MESSAGE_IN variable at its local scope when set with the correlating of the message.
I just don’t know how to make this work in camunda 8.
I assume that you want to define a local variable in the scope of the event subprocess. As a result, a variable from the message should be in the scope of the event subprocess to avoid that it is overridden by the next message.
The variable propagation in Camunda Platform 8 works similar to Camunda Platform 7. To have a local variable of the event subprocess, add an input mapping to the event subprocess. It can be initialized with = null. For example, local variable name MESSAGE_IN with value = null. If a message is correlated then the value of the variable MESSAGE_IN is set in the scope of the event subprocess.