Hi Zeebe Experts,
I’ve modeled this process to execute it with Zeebe:
My expectation was, that a parallel gateway will create a local scope for variables (as it did for Camunda 7).
But it’s didn’t seem so. The ‘Display all variables’ task shows a single process variable userName: “Anne”.
I’ve added a userName output mapping to create a local scope in my BPMN:
parallelVariables.bpmn (9.8 KB)
Whats the issue here?
Thank you, Ingo
You’ve used output mappings.
If one or more output mappings are defined, the job/message variables are set as local variables in the scope where the mapping is defined. Then, the output mappings are applied to the variables and create new variables in this scope. The new variables are merged into the parent scope.
This description is about using output mappings to customize how the variables of jobs or messages are merged into the process, but the result is the same. Output mappings merge the resulting variables into the process, and that means the variables will propagate if they haven’t been defined in other scopes yet.
In your example, the variables are propagated into the process instance scope.
EDIT: note that C8 doesn’t consider executions as scopes. Only element instances are scopes. So in your example, there is only the process instance scope, or the scope of each element. As soon as an element is completed, that scope is gone.
thank you for your reply.
Are there any plans to add local scopes for parallel paths as in Camunda 7?
Kind regards, Ingo
We don’t plan to add local scopes for execution paths to C8. Is there a specific use case you have in mind?
I don’t have a specific use case, I’m just thinking about product gaps when customers want to migrate from Camunda 7 to Camunda 8 and how to estimate the migration effort.
The workaround would be to introduce an embedded subprocess to hand over local variables from one task to another:
Thank you, Ingo
Here is the tested BPMN diagram:
parallelVariables.bpmn (14.3 KB)
Yes, that is the correct way to model this in C8. Notice how much clearer the process has become when it comes to showcasing where the data exists. IMO, scoping data to elements instead of executions is one of C8’s innovations over C7.
But if you have large processes using the local execution scope in Camunda 7 it takes some effort to identify the local variables and adjust the process model for a migration to Camunda 8. It requires complicated code inspections.
Interesting point. We could consider whether this is a problem we could solve in the migration tools.