WSO2 ESB - Router Mediator

Router Mediator

Router is specifically designed for what it name suggests. Routing messages.

Router mediator can contain any number of routes. Router mediator can be configured to continue or to stop the mediation after the routing by setting the 'continueAfter' attribute value to be 'true' and 'false' respectively. Each and every route must contain an 'expression' attribute which is to specify the XPath over which the roting condition is evaluated. Apart from that there can be an optional 'match' attribute as well. If both expression and the match attirbutes are specified in a particualr route, the evaluated string value of the XPath over the current message will be campared with the reular expression provided as the value of the match attribute to see whether this route is matching for the current message. Where as if only the expression is specified, presence of the element specified by this XPath is considered as the routing condition.

One can configure a route to break routing or continue evaluating further routes to see any further matchings by setting the 'breakRoute' attribute to 'true' or 'false' respectively. For all the routes there has to be a 'target' element which contains the information about the routing path as a sequence or an endpoint both can be inlined as well as refered. If both an endpoint and a sequence is specified message will be first mediated through the sequence and sent to the endpoint after mediation. Particular target cannot contain an inline sequence and a refered sequence at the same time. The same applies to endpoit of the target as well.

Syntax

<router [continueAfter=(true | false)]>
  <route expression="xpath" [match="regEx"] [breakRouter=(true | false)]>
    <target [sequence="string"] [endpoint="string"]>
      <sequence ....../>?
      <endpoint ....../>?
    </target>
  </route>+
</router>

UI Configuration

Router

Figure 1: Router Mediator

The router mediator has the following configuration options.

Route

Route Mediator

Here are the options available in the Route mediator configurations.

Example