Scope of variables in Scatter Gather router of Mulesoft

What is the scope of variables in Scatter Gather component of Mule 4?


If a variable in one route is updated, it does not affect the same variable in other route. So, if a variable is added or modified in one route, then, after aggregation, the final value is the value set by that route. Observe choice 2 variable from example below. If a same variable is added or modified by more than one route, the value is added to a list of all the values defined for that variable within all the routes. Observe choice 3 variable from example below. Every route starts with the same original values of the variable




Scope of variables in Scatter Gather router of Mule 3


The final values after aggregation of Scatter Gather router:


{choice1: "India", choice2: "Australia", choice3: ["USA, UK, UAE"], choice4: "Germany"}

When Scatter Gather is used inside For Each scope:


If a variable is created before for-each and is modified inside the for-each,  then the value of the variable is updated even after the for each flow is finished. But consider If there is a scatter-gather in the for-each before the variable is updated, then value of the variable afterthe for-each is not modified. It has the original value.


Post a Comment

0 Comments