Setting local variables in execution which is going to be created next

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Setting local variables in execution which is going to be created next

Consider that there is a  " Service task A "  which is attached to a parallel gateway then there are two tasks "Service Task B " and "Service task C".

I have marked " Service Task B " , "Service task C" and parallel gateway as Asynchronous.

Therefore a new execution will be created to execute "Service task C" .

Suppose Execution 1 was executing Service Task A and then

Execution 1 started executing Service Task B and

Execution 2 was created and it started executing service task B

How to make execution 2 aware that it was created from execution 1 ?

Similarly while On Join only 1 execution remains then in parallel gateway I want to collect local variables of both execution 2 and execution 1 and perform some operation and make a new variable on the surviving execution 

After service task A I need to dynamically set X = 1 for 1 execution and X = 2.5 for other execution.

If i can set those values in listener of parallel gateway then how can i identify which is old execution and which is new execution .

1 Reply
Highlighted
Intermediate

Re: Setting local variables in execution which is going to be created next

Not sure I completely understand your scenario, but if you have marked both Service Task B and Service Task C as asynchronous, then the original execution from Service Task A is released as soon as you hit the gateway.

You can prove this by logging the execution ID from each of the service tasks.

As for collecting local variables from each of the branch executions, you can set variables on the process instance which will be child execution agnostic.
I typically use map with the execution id as the key so there is no overlap between the different branches.

Another option for somethign ilke this is to use a multi instance loop.

Perhaps I am missing what you are trying to do, perhaps a more specific example.

Greg