I'm using a foreach component in mule.I'm iterating a collection object using Foreach .Here for ForEach component I,m sending a collection payload as a input .The Foreach iterates the collection payload. But the issue is I can't able to fetch the Iterated foreach payload in my next component.
Here is my code Snippnet
<choice doc:name="Choice">
<when expression="#[ognl:instance=='Lamp']">
<processor-chain>
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="loops" value="0"/>
</message-properties-transformer>
<component class="com.Lamp" doc:name="Java"/>
<foreach doc:name="Foreach">
<component class="com.Candle" doc:name="Java"/>
<logger message="DDD #[message:payload]" level="INFO" doc:name="Logger"/>
<set-variable variableName="foreachPayload" value="#[message:payload]" doc:name="Payload"/>
</foreach>
</processor-chain>
</when>
Here as I'm not able to get the payload of the foreach component directly ,I have tried to set that payload in a variable named "foreachPayload" . But while accessing the variable in the next component, the last value of the iterated collection object is there not the entire value of the iterated collection object.
Here is the code snippet of accesing the session variable.
eventContext.getMessage().getInvocationProperty("foreachPayload")
Please let know the what is the issue over here and the way to resolve this .
The below is attached is the screenshot of my message flow