This documentation is for WSO2 ESB version 4.5.0. View documentation for the latest release.

Conditional Router Mediator

The Conditional Router Mediator (New in version 4.0) can be used to specify the routing of the message according to given conditions. This mediator checks whether the "Condition" evaluates to true and mediates using the target sequence. A matching route will break the router if the "Break after route" is set to true.



Syntax

<conditionalRouter continueAfter="(true|false)">
    <route breakRoute="(true|false)">
      <condition ../>
      <target ../>
    </route>+
</conditionalRouter>

UI Configuration

1. The user can define any number of routes. Each and every route must contain a "condition" which is to be evaluated and a predefined "Target" sequence, which will be used to mediate further. To add a route, click on the "Add Route" link.

2. Specify the following options of the Router:

Parameter NameDescription
Continue after routing

This parameter specifies whether the mediation flow should/should not continue after executing the conditional router mediator. Possible values are as follows.

  • Yes/True: If this is selected, mediation continues to execute (any other mediators specified) after the conditiional router mediator.
  • No/False: If this is selected, mediation discontinues after executing the conditiional router mediator. This is the default value.
Break after route

You can specify this for each conditional route of the conditional route mediator. It specifies whether the router should/should not continue after executing the specified conditional route.

  • Yes/True: If this is selected, a matching route would break the router, so that it does not continue to execute the next conditional route.
  • No/False: If this is selected, the router continues to execute the next conditional route defined in the conditional router mediator.
Evaluator ExpressionRoute condition. For example, you can specify that a message is routed based on the its header (provides better performance) or its content (provides more fine-grained searching). 
Target Sequence

A target sequence needs to be provided as registry key/local entry to do further mediation processing.