Clone Mediator¶
The Clone Mediator can be used to clone a message into several messages. It resembles the Scatter-Gather enterprise integration pattern. The Clone mediator is similar to the Iterate mediator. The difference between the two mediators is that the Iterate mediator splits a message into different parts, whereas the Clone mediator makes multiple identical copies of the message.
Info
The Clone mediator is a [content-aware](https://apim.docs.wso2.com/en/4.1.0
/reference/mediators/about-mediators/#classification-of-mediators) mediator. Also, note that to get the asynchronous behavior we have to have the sequence to inject the message context to that sequence asynchronously. We can not achieve that by adding the endpoint itself to the target without adding the sequence.
Syntax¶
<clone [continueParent=(true | false)]>
<target [to="uri"] [soapAction="qname"] [sequence="sequence_ref"] [endpoint="endpoint_ref"]>
<sequence>
(mediator)+
</sequence>?
<endpoint>
endpoint
</endpoint>?
</target>+
</clone>
Configuration¶
The parameters available to configure the Clone mediator is as follows.
Parameter Name | Description |
---|---|
Clone ID | Identification of messages created by the clone mediator. This is particularly useful when aggregating responses of messages that are created using nested Clone mediators. |
Sequential Mediation | This parameter is used to specify whether the cloned messages should be processed sequentially or not. The processing is carried based on the information relating to the sequence and endpoint specified in the target configuration. The possible values are as follows.
|
Continue Parent | This parameter is used to specify whether the original message should be preserved or not. Possible values are as follows.
|
Number of Clones
|
The parameter indicates the number of targets which currently exist for the Clone mediator. Click Add Clone Target to add a new target. Each time you add a target, it will be added as a child of the Clone mediator in the mediator tree as shown below. Click Target to add the target configuration as described below. |
Target configuration¶
The parameters available to configure the target are as follows.
Parameter Name | Description |
---|---|
SOAP Action | The SOAP action of the message. |
To Address | The target endpoint address. |
Sequence | This parameter is used to specify whether cloned messages should be mediated via a sequence or not, and to specify the sequence if they are to be further mediated. Possible options are as follows.
|
Endpoint | The endpoint to which the cloned messages should be sent. Possible options are as follows.
|
Example¶
In this example, the Clone Mediator clones messages and redirects them to a Default endpoint and an existing sequence.
<clone xmlns="http://ws.apache.org/ns/synapse">
<target>
<endpoint name="endpoint_urn_uuid_73A47733EB1E6F30812921609540392-849227072">
<default />
</endpoint>
</target>
<target sequence="test1" />
</clone>
Top