anonMule
anonMule

Reputation: 91

Mule how to add to the array used in for each?

I have an array in Mule that I am iterating over. I believe the for each makes a copy of the array I pass it and iterates through that. Is it possible to access that copy by reference and modify it? Based on certain conditions I would like to add extra elements to the array. I have tried to use vars.rootMessage but it does not give me what I am expecting.

Upvotes: 0

Views: 1235

Answers (1)

aled
aled

Reputation: 25664

No. Just create a new array in a variable and add to it. To provide more context, Mule 4 variables live in Mule Events, which are immutable. That means that a change results in the creation of a new event.

Upvotes: 2

Related Questions