This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

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 option of the Route:

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: If this is selected, mediation continues to execute (any other mediators specified) after the conditiional router mediator.
  • No: 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.

  • True: If this is selected, a matching route would break the router, so that it does not continue to execute the next conditional route.
  • 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.


Example

To see an example of the Conditional Router mediator, see Sample 157: Conditional Router for Routing Messages based on HTTP URL, HTTP Headers and Query Parameters.

  • No labels