Routing Slip – routing a message to a fixed list of endpoints
When you need to dynamically compute the list of endpoints to route a message to at runtime, a Routing Slip EIP can help. The Routing Slip can use a message, an external source, or typically a message header (generated from a previous route step) to determine the list of endpoints to route the message to.
![](https://static.packt-cdn.com/products/9781782170303/graphics/0303EN_02_06.jpg)
The Routing Slip is different from the Dynamic Router in that the Routing Slip Expression is only called once to determine the list of endpoints, whereas the Dynamic Router Expression is called multiple times until it decides it is time to stop routing (returns null
).
This recipe will show you how to specify an Expression that will determine how to route each individual message to a runtime provided with a list of endpoints.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.routing.routingslip
package. The Spring XML files are located under src/main/resources/META-INF/spring
and are prefixed with routingSlip...