MULE-6990: OOM exception using foreach

_ Adding a filter into the MP pipeline to avoid storing the result of each part's processing
(cherry picked from commit ecb5f7c)
MULE-6990: OOM exception using foreach

_ Fixing test
(cherry picked from commit 9ef435d)