Versions Compared

Key

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

A mediation sequence, commonly called a "sequence," is a tree of mediators. That means it can hold other mediators and execute them. When a message is delivered to a sequence, it sends the message through all its child mediators.

Image RemovedImage Added

There are two types of sequences:

  • In-line Sequences
Code Block
XML
XML

<sequence name="string">other mediators</sequence>

...

  • Named Sequences
Code Block
XML
XML

<sequence key="name"/>

The named sequences refer other sequences using a key. This allows reusing of sequences.

...

  • Main Sequence
Code Block
XML
XML

<syn:sequence name="main" xmlns:syn="http://ws.apache.org/ns/synapse">
      <syn:log/>
      <syn:drop/>
</syn:sequence>
  • Fault Sequence
Code Block
XML
XML

<syn:sequence name="fault" xmlns:syn="http://ws.apache.org/ns/synapse">
      <syn:log level="full">
      <syn:property name="MESSAGE" value="Executing default&quot;fault&quot; sequence"/>
      <syn:property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
      <syn:property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
      </syn:log>
      <syn:drop/>
 </syn:sequence>

Refer to the list of available properties in Properties.

All the messages that are not for Proxy Services will be sent through the "main" sequence.

A sequence can have an error handler. Error handler is again another sequence. If an error occurs while executing a sequence, its error handler will be called. Every sequence has an error handler. If one is not explicitly specified, the fault sequence will be treated as the error handler. Refer to an example of error handling here.

Info
titleNote

Message mediation always processes messages according to the mediation sequence defined as "main."

Excerpt
hiddentrue

General information about Mediation Sequences in WSO2 ESB.