# cMessageRouter

Creates different channels for each filtered message type according to specified conditions so that messages can later on be treated more accurately in each new channel.

For more information, see the Apache camel documentation https://camel.apache.org/components/latest/.

## cMessageRouter Standard properties

These properties are used to configure cMessageRouter running in the Standard Job framework.

The Standard cMessageRouter component belongs to the Routing family.

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | cMessageRouter is used as a<br>middle component in a Route. It can only have one input channel but<br>multiple output channels. Messages can be outputted through either a<br>When, Otherwise or Route<br>types of connection. |
| Connections | <ul> <li> <span>Row / Route</span>: Select this link to pass on all                  the messages to the next component.</li> <li> <p> <span>Trigger / When</span>: Select the                        <span>When</span> link and click the                        <span>Component</span> view.</p> <p>In the <span>Type</span> list, select the type of language you will                     use to declare your condition from <span>none</span>,                        <span>bean</span>, <span>constant</span>,                        <span>correlation</span>, <span>el</span>,                        <span>groovy</span>, <span>header</span>,                        <span>sql</span>, <span>jsonpath</span>,                        <span>jxpath</span>, <span>mvel</span>,                        <span>ognl</span>, <span>php</span>,                        <span>property</span>, <span>python</span>,                        <span>ruby</span>, <span>simple</span>,                        <span>Spel</span>, <span>sql</span>,                        <span>xpath</span>, and <span>xquery</span>.</p> <p> <span>Append endChoice()</span>: If the <span>When</span>                     link is followed by a <span>cMessageFilter</span> or                        <span>cLoadBalancer</span> and so on, there will be a compile                     error. This is because once there is such a component there, the flow type will                     change from choice() to loadbalance(), which can not be followed by a                        <span>When</span> or <span>Otherwise</span> link. Select                     this check box to change the flow type back from loadbalance() to choice().</p> <p>In the <span>Condition</span> field, type in the condition that will                     be used to filter the messages.</p> <p>All the messages that do not match this condition are retrieved with the                        <span>Otherwise</span> link to a different channel or dropped if                     an <span>Otherwise</span> link does not present. </p> <div><span>Information note</span><span>Note:</span> <p>There can be more than one <span>When</span> link in a Route.</p> </div> </li> <li> <p> <span>Trigger / Otherwise</span>: This link                     automatically retrieves the messages that do not match the                        <span>When</span> conditions. </p> <div><span>Information note</span><span>Note:</span> <p>There can be only one <span>Otherwise</span> link, which is                        optional, in a Route.</p> </div> </li> </ul> |
| Limitation | It is recommended not to put any message handling after the<br>When or the Otherwise link. Always use a Mock/Direct<br>endpoint to replace them and make a new Route to handle the<br>messages. |

**Related concepts**

* [Routing messages according to a criterion](https://help.qlik.com/talend/en-US/mediation-components/8.0/mediation-filter/cmessagerouter-cmessagingendpoint-cfile-clog-routing-messages-according-to-criterion)