Versions Compared

Key

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

The Sequence Mediator refers to an already defined sequence element, which is used to invoke a named sequence of mediators. This is useful when you need to use a particular set on mediators in a given order repeatedly.

You can alternatively select a pre-defined sequence from the registry as the in/out/fault sequence for a proxy service or a REST service without adding any mediator configurations inline. The difference between these two options are described in the table below.

AttributePicking a pre-defined sequence as in/out/fault sequenceReferring to a pre-defined sequence via the Sequence mediator
Adding other mediatorsOther mediator configurations that are not already included in the pre-defined sequence cannot be added to the in/out/fault sequence.Other mediator configurations that are not already included in the pre-defined sequence can be added to the in/out/fault sequence
Applying changes done to the pre-defined sequenceAny changes done to the sequence saved in the registry after it was selected as the in/out/fault sequence will not be considered when carrying out mediation.Any changes done to the sequence saved in the registry after it was selected as the in/out/fault sequence will be considered when carrying out mediation.
Info

The Sequence mediator is a content-unaware mediator.

...

Table of Contents
maxLevel3
minLevel3
styleborder:1
locationtop
typeflat
separatorpipe

...

Code Block
XML
XML
<sequence key="name"/>

...

UI Configuration

In

The parameters available to configure the "Sequence Mediator" panel, you can specify the name of the sequence you want to refer to or select it from the registry by clicking the appropriate Registry Browser link.

To specify the Key Type, select:

...

Sequence mediator are as follows.

Parameter NameDescription
Key Type

This parameter defines whether the key to access the required sequence is a static key or a dynamic key. Possible values are as follows.

  • Static Key: If this is selected, the key to access the sequence is a static value. You can click either Configuration Registry or Governance Registry as relevant to select the require key from the resource tree for the Referring Sequence parameter.
  • Dynamic Key: If this is selected, you can define the key to access the sequence as a dynamic value by entering an XPath expression in the Referring Sequence parameter.
Referring sequence

The key to access the sequence saved in the registry. You can enter a static value selected from the resource tree, or an XPath expression based on the option you selected for the Key Type parameter.

Info
titleTip

You can click NameSpaces to add namespaces if you are providing an expression. Then the Namespace Editor panel would appear where you can provide any number of namespace prefixes and URLs used in the XPath expression. 

Example

In this example, the following sequence named StoreSend is saved in the Configuration registry. It includes a Store Mediator to store the request in a message store named JMSMS and a Send Mediator to send it to an endpoint afterwards.

Code Block
languagexml
<sequence xmlns="http://ws.apache.org/ns/synapse" name="conf:/StoreSend">
   <axis2ns4:store xmlns:axis2ns4="http://ws.apache.org/ns/synapse" messageStore="JMSMS" sequence="conf:/repository/components/org.wso2.carbon.throttle/templates"></axis2ns4:store>
   <send>
      <endpoint>
         <address uri="http://localhost:9000/services/SimpleStockQuoteService"></address>
      </endpoint>
   </send>
</sequence>

The Sequence mediator configuration can be as follows to invoke the StoreSend sequence after using a PayloadFactory mediator to transform the contents of the request.

Code Block
languagexml
<inSequence xmlns="http://ws.apache.org/ns/synapse">
	<payloadFactory media-type="xml">
      <format>
           <m:checkpriceresponse xmlns:m="http://services.samples/xsd">
               <m:code>$1</m:code>
               <m:price>$2</m:price>
           </m:checkpriceresponse>
      </format>
      <args>
           <arg expression="//m0:symbol" xmlns:m0="http://services.samples/xsd">
           <arg expression="//m0:last" xmlns:m0="http://services.samples/xsd">
      </arg></arg></args>
	</payloadFactory>
   	<sequence key="conf:/StoreSend"></sequence>
</inSequence>
Excerpt
hiddentrue

Description of the Sequence Mediator in WSO2 ESB.