Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Iterate Mediator implements the Splitter enterprise integration pattern and splits the message into a number of different messages derived from the parent message by finding matching elements for the XPath expression specified. New messages are created for each and every matching element and processed in parallel (default behavior) using either the specified sequence or endpoint. Created messages can also be processed sequentially by setting the optional sequential attribute to true. The original message can be continued or dropped depending on the boolean value of the optional continueParent attribute. The Iterate mediator is similar to the Clone mediator, with the difference being that the Iterate mediator splits a message into different parts, whereas the Clone mediator makes multiple identical copies of the message.

...

Table of Contents
maxLevel3
minLevel3
locationtop
styleborder:1
locationtop
typeflat
separatorpipe

...

Syntax

Code Block
XML
XML
<iterate [sequential=(true | false)] [continueParent=(true | false)] [preservePayload=(true | false)] (attachPath="xpath")? expression="xpath">
   <target [to="uri"] [soapAction="qname"] [sequence="sequence_ref"] [endpoint="endpoint_ref"]>
     <sequence>
       (mediator)+
     </sequence>?
     <endpoint>
       endpoint
     </endpoint>?
   </target>+
</iterate>

...

  • Iterate ID - Can be used to identify messages created by the iterate mediator. Useful when defining nested iterate mediators.
  • Sequential Mediation - Specifies whether split messages should be processed sequentially (True) or in parallel (False). If True is selected, you may experience a delay due to relatively high resource consumption. Therefore, it should be selected only when the order of the message is important. If False is selected, you may experience better performance. However, it is advisable to increase the size of the thread pool to enable the backend to handle the processing better. Default value is

    "false"

    False (parallel processing). 

    Excerpt
    hiddentrue

    Information was added to this description with reference to the question "How can i decide whether to use sequential="true" or sequential="false" ?" in the /wiki/spaces/FAQ/pages/37781537 page.

  • Continue Parent -Specifies whether the original message should be continued or dropped.
    • True
    • False

      Info
      titleTip

      This is default to false.

  • Preserve Payload -Specifies whether the original message should be used as a template when creating the split messages.
    • True
    • False

      Info
      titleTip

      This is default to false.

  • Iterate Expression - XPath expression that matches the elements, which you want to split the message from.
  • Attach Path - To form new messages, you can specify an XPath expression for elements that the split elements are attached to (as expressed in Iterate expression).

...

In this scenario, the Iterate Mediator splits the messages into parts and processes them asynchronously. Excerpt

hiddentrue
Description of the Iterate Mediator in WSO2 ESBSee also Splitting Messages into Parts and Processing in Parallel (Iterate/Aggregate).