The ForEach Mediator processes a collection, such as a JSON array or XML list derived from the message body or a defined variable, by splitting it into multiple messages, each corresponding to an item in the collection. The message in each iteration is flowing through the specified mediation sequence. After flowing through the mediation sequence, the sub-messages in each iteration are merged back to the corresponding original parent collection in the original message body or variable.
This parameter specifies the collection to be processed by the ForEach mediator. You need to provide an expression that points to a collection within the message body or a variable. The collection can be extracted as follows depending on the content type.
JSON
: ${payload.items}
XML
: ${xpath('//data/list')}
Variable
: ${var.myCollection}
Execute Parallel
Specifies whether the messages should be processed in parallel.
True
(default): Executes the messages in parallel.
False
: Executes the messages sequentially.
Continue without aggregation
Specifies whether the parent flow should continue without waiting for the aggregation.
True
: Continue the parent flow without waiting for the aggregation.
False
(default): Wait till aggregation completes and continue the flow.
You can access the current iteration number using this variable within the sequence used in the ForEach mediator. This option is available only when
Parallel Execution is disabled.