Setting variables in parallel flow

I have a Process flow that uses the parallel gateway to run two activities in parallel. In each activity I have a ExecutionListner which adds the name of that Activity to a Global variable (list). The issue I am seeing is that when the flow joins back into a Parallel join and move to the next activity the Global variable has only the last Activity that was completed in the list. The activity that is complete first through uses the same Execution listener and add the Activitiy name of the list. It is getting lost.

I tried putting asyc continuation after each activity and asyc continuation before the join activity, but it is not helping. I get the variable using delegateExecution.getVariable(…)

How can is make this persists the changes done on the parallel flow?

@adat

Hi @adat,

To understand better your use case, it would be helpful if you attach your process.

Best regards,
Yana

Yana

Here is how it looks like…

I am referring to the first parallel gateway where it flows through 2 activities in each path.
When it reached the second parallel join and to the next activity after that, it persists only the more recently followed path Actvity name. Each of this actvitiies have same listener class and I use delegeteexecution to set the variable. The variable is a Java List where I add the activity name after the start of each activity.

Here is what I get in the variable after the first activities are started I get the following in the list :

  1. IHC- Preperation for Scenario Creation Workshop
  2. Prepare for CPC

When Prepare for CPC completed I get the following in the list :

  1. IHC- Preperation for Scenario Creation Workshop
  2. Prepare for CPC
  3. _ IHC RSG - Approval of Scenarios (Variable Paths and Narratives)_

Now IHC RSG - Approval of Scenarios (Variable Paths and Narratives) will be completed first and it will wait in the join for parallel flow to complte.

When I complete the activity in the other branch and when it reaches the activity after the parallel join I get

1. IHC- Preperation for Scenario Creation Workshop
2. Prepare for CPC
3. IHC RSG - Presentation of CIB Fin & Non-Fin Risks /Scenario Creation Workshop.

_ IHC RSG - Approval of Scenarios (Variable Paths and Narratives)_ is lost as it was not the latest activity to be completed during the parallel paths.

Thanks
@adat

Thanks
@adat

Not 100% sure, as I encountered similar problems, but:

Assure that the List is defined outside and before the parallel gateway starts.

Assure that you don’t re-define the List variable in some way inside the parallel gateway.

If you define something inside the parallel subprocess, try to use only local variables (execution.setLocalVariable(…)).

Another try I suggest is: try to do it without external delegates, using only groovy scripting (it’s faster to debug). Anyway if the delegate class takes the correct execution object, everything should work correctly.

@Mizar01.

Thanks for the reply. Yes the List is defines out as Global variable. I do not use nay local variables

@adat .