Routing Slip

The Routing Slip from the EIP patterns allows you to route a message consecutively through a series of processing steps where the sequence of steps is not known at design time and can vary for each message.


Name Default Value Description
uriDelimiter , Delimiter used if the Expression returned multiple endpoints.
ignoreInvalidEndpoints false If an endpoint uri could not be resolved, should it be ignored. Otherwise Camel will thrown an exception stating the endpoint uri is not valid.


The following route will take any messages sent to the Apache ActiveMQ queue SomeQueue and pass them into the Routing Slip pattern.


Messages will be checked for the existance of the "headerName" header. The value of this header should be a comma-delimited list of endpoint URIs you wish the message to be routed to. The Message will be routed in a pipeline fashion (i.e. one after the other).

Note: In Camel 1.x the default header name routingSlipHeader has been @deprecated and is removed in Camel 2.0. We feel that the DSL needed to express, the header it uses to locate the destinations, directly in the DSL to not confuse readers. So the header name must be provided.

From Camel 2.5 the Routing Slip will set a property (Exchange.SLIP_ENDPOINT) on the Exchange which contains the current endpoint as it advanced though the slip. This allows you to know how far we have processed in the slip.

The Routing Slip will compute the slip beforehand which means, the slip is only computed once. If you need to compute the slip on-the-fly then use the Dynamic Router pattern instead.

Configuration options

Here we set the header name and the URI delimiter to something different.

Using the Fluent Builders

from("direct:c").routingSlip(header("aRoutingSlipHeader"), "#");

Using the Spring XML Extensions

<camelContext id="buildRoutingSlip" xmlns="">
    <from uri="direct:c"/>
    <routingSlip headerName="aRoutingSlipHeader" uriDelimiter="#"/>

Ignore invalid endpoints

Available as of Camel 2.3

The Routing Slip now supports ignoreInvalidEndpoints which the Recipient List also supports. You can use it to skip endpoints which is invalid.


And in Spring XML its an attribute on the recipient list tag.

       <from uri="direct:a"/>
       <routingSlip headerName="myHeader" ignoreInvalidEndpoints="true"/>

Then lets say the myHeader contains the following two endpoints direct:foo,xxx:bar. The first endpoint is valid and works. However the 2nd is invalid and will just be ignored. Camel logs at INFO level about, so you can see why the endpoint was invalid.

Expression supporting

Available as of Camel 2.4

The Routing Slip now supports to take the expression parameter as the Recipient List does. You can tell the camel the expression that you want to use to get the routing slip.


And in Spring XML its an attribute on the recipient list tag.

       <from uri="direct:a"/>
       <!--NOTE from Camel 2.4.0, you need to specify the expression element inside of the routingSlip element -->
       <routingSlip ignoreInvalidEndpoints="true">

Further Examples

For further examples of this pattern in use you could look at the routing slip test cases.

Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.

© 2004-2011 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram