...
ForEach mediator mediation happens in a single thread as a blocked execution. The ForEach mediator creates the following properties during mediation.
Property | Description |
---|---|
FOREACH_ORIGINAL_MESSAGE | This contains the original envelope of the messages split by the ForEach mediator. |
FOREACH_COUNTER | This contains the count of the messages processed. The message count increases during each iteration. |
Note |
---|
Iterate mediator is quite similar to the ForEach mediator. You can use complex XPath expressions to conditionally select elements to iterate over in both mediators. Following are the main difference between ForEach and Iterate mediators:
When you use ForEach mediator, you can only loop through segments of the message and do changes to a particular segment. For example, you can change the payload using payload factory mediator. But you cannot send the split message out to a service. Once you exit from the for-each loop, it automatically aggregates the split segments. This replaces the for-each function of the complex XSLT mediators using a ForEach mediator and a Payload Factory mediator. However, to implement the split-aggregate pattern, you still need to use Iterate mediator. |
...
The parameters available to configure the ForEach mediator are as follows.
Parameter Name | Description | ||
---|---|---|---|
ForEach ID | If a value is entered for this parameter, it will be used as the prefix for the FOREACH_ORIGINAL_MESSAGE and FOREACH_COUNTER properties created during mediation. This is an optional parameter. However, it is recommended to define a ForEach ID in nested ForEach scenarios to avoid the properties mentioned from being overwritten. | ||
Expression | The XPath expression with which different messages are derived by splitting the parent message. This expression should have matching elements based on which the splitting is carried out.
| ||
Sequence | The mediation sequence that should be applied to the message is derived from the parent message. ForEach mediator is used only for transformations, thereby, you should not include Call, Send and Callout mediators, which are used to invoke endpoints, in this sequence.
|
Info | ||
---|---|---|
| ||
You can configure the mediator using XML. Click switch to source view in the Mediator window. |
...