Nav

For Each Scope XML Reference

For Each scopes open and close with a <foreach> tag. Components that are affected by this scope are defined as child elements of the <foreach> tag.

Configurable Properties

Property Default Description

collection

payload

An expression to that returns a Java collection, object array, map, or DOM nodes.

counterVariableName

counter

Name of the property that stores the number of messages over which it iterates.

batchSize

1

Partitions the collection into sub-collections of the specified size. For example, if a collection has 200 elements and you set the batch size to 50, it processes 4 batches of 50 elements each.

rootMessageVariableName

rootMessage

Name of the property that stores the parent message. The parent is the complete, unsplit message.

Example


         
      
1
2
3
4
<foreach doc:name="For Each" collection="#[payload.myNode]" batchSize="2" rootMessageVariableName="myRootMessage" counterVariableName="myCounter">
    <some-nested-element/>
    <some-other-nested-element/>
</foreach>