Clone Mediator

As the name suggests clone meditor can be used to clone a message in to several messages.

The clone mediator closely resembles the Message Splitter EIP and will split the message into number of identical messages which will be processed in parallel. They can also be set to process sequentially by setting the value of the optional 'sequential' attribute to 'true'. The original message cloned can be continued or dropped depending on the boolean value of the optional 'continueParent' attribute. Optionally a custom 'To' address and/or a 'Action' may be specified for cloned messages. The optional 'id' attribute can be used to identify the clone mediator which created a particular splitted message when nested clone mediators are used. This is particularly useful when aggregating responses of messages that are created using nested clone mediators.

Syntax

 <clone [id="id"] [continueParent=(true | false)] [sequential=(true | false)]>
   <target [to="uri"] [soapAction="qname"] [sequence="sequence_ref"] [endpoint="endpoint_ref"]>
     <sequence>
       (mediator)+
     </sequence>?
     <endpoint>
       endpoint
     </endpoint>?
   </target>+
 </clone>

UI Configuration

Figure 1: Clone mediator options

Clone mediator field descriptions,

  • Clone ID - This can be used to identify messages created by this clone mediator. This is particularly useful when aggregating responses of messages that are created using nested iterate mediators.
  • Sequential Mediation - If "Yes" created messages will be processed sequentially, otherwise they will be processed in parallel.
  • Continue Parent - If "Yes" the original message will be continued. If "No" the original message will be dropped.
  • Number of clones - Number of clones created. This can be controlled by adding one or more clone targets by clicking Add Clone Target.Targets can then have it's own set of mediators.

Figure 2: Adding a clone target

For more information about target refer Target.

Example

<clone xmlns="http://ws.apache.org/ns/synapse">
   <target>
      <endpoint name="endpoint_urn_uuid_73A47733EB1E6F30812921609540392-849227072">
         <default />
      </endpoint>
   </target>
   <target sequence="test1" />
</clone>

In this example the clone mediator clones messages and redirect them two a default endpoint and an existing sequence.