<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  <title>WSO2 EI - Router Mediator </title>
  <link href="css/EI-docs.css" rel="stylesheet" />
  <link href="styles/dist-docs.css" rel="stylesheet" type="text/css"
  media="all" />
</head>

<body>
<h2>Router Mediator</h2>

<p>Router is specifically designed for what it name suggests. Routing
messages.</p>

<p>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
attributes are specified in a particular route, the evaluated string value of
the XPath over the current message will be compared with the regular 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.</p>

<p>One can configure a route to break routing or continue evaluating further
routes to see any further matching 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 inline as well as referred. 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 referred sequence at the same time. The same applies to
endpoint of the target as well.</p>

<h3>Syntax</h3>
<pre xml:space="preserve">&lt;router [continueAfter=(true | false)]&gt;
  &lt;route expression="xpath" [match="regEx"] [breakRouter=(true | false)]&gt;
    &lt;target [sequence="string"] [endpoint="string"]&gt;
      &lt;sequence ....../&gt;?
      &lt;endpoint ....../&gt;?
    &lt;/target&gt;
  &lt;/route&gt;+
&lt;/router&gt;</pre>

<h3>UI Configuration</h3>

<h4>Router</h4>

<p><img src="../router-mediator/docs/images/router_mediator_screenshot.jpg"
alt="" /> </p>

<p><strong>Figure 1: Router Mediator</strong> </p>

<p>The router mediator has the following configuration options. </p>
<ul>
  <li>Continue after routing: (Yes/No), Whether to continue the routing if any
    of the child routes are executed. The default value is No. </li>
  <li>Number of clones: Show you the number of child routes that router
    mediator has. You can add child routes by clicking the 'Add Route' link in
    the right hand side of the text field. </li>
</ul>

<h4>Route</h4>

<p><img src="../route-mediator/docs/images/route_mediator_screenshot.jpg"
alt="" /> </p>

<p><strong>Route Mediator</strong> </p>

<p>Here are the options available in the Route mediator configurations. </p>
<ul>
  <li>Break After Route: (Yes/No) Specify whether to continue with the sibling
    routes or stop from the current route, if the routing condition is
    successful. </li>
  <li>Route Expression: An xpath expression to execute on the message </li>
  <li>Route Pattern: A regular expression to compare with the value retrieved
    from the above xpath expression. </li>
</ul>

<h3>Example</h3>
<pre xml:space="preserve">
&lt;router&gt;
    &lt;route xmlns="http://ws.apache.org/ns/synapse" xmlns:ns1="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" expression="header/sourcefile/@name" match="EI*"&gt;
    &lt;target&gt;
      &lt;endpoint name="endpoint_urn_uuid_867AD5A624748DD63619739416601328-2078896617"&gt;
         &lt;default /&gt;
      &lt;/endpoint&gt;
   &lt;/target&gt;
    &lt;/route&gt;
&lt;/router&gt;    
</pre>
<p></p>
</body>
</html>
