EIPinCPI – Content-based Router

December 15, 2019 Bhalchandra Wadekar

This week, we’ll study a variation of Message Router pattern known as Content-based Router.

When do I use this pattern?

This pattern can be applied when the message needs to be routed based on the contents of the message. For example, if a delivery is to be done in the UK, it is sent to Delivery System in the UK, if the delivery is to be done in India, it is sent to Delivery System in India. In this example, the value of the Country element can be used to send a message to one system or another.

Content-based Router in CPI

As in the Message Router pattern blog, Content-based Router in CPI is implemented using Router component. In the Message Router pattern blog, the example of routing the IDoc based on the value of IDOCTYP element is an example of Content-based Router.

In this blog, we’ll focus on sending a message into a different Delivery System based on the content of the Country element.

Let’s consider these two payloads:

Input 1:


Input 2:


Integration Flow

Here, the DS is a central delivery system sending deliveries to delivery systems in each country.

The routing has been achieved using the Router ‘Country’. Here’s the configuration of the Routing Condition table:

Order Route Name Condition Expression Default Route
1 India /Delivery/Country = ‘India’ No
2 UK /Delivery/Country = ‘UK’ No
3     Yes


Content-based Router is a type of Message Router that is used, as the name suggests when a message needs to be routed based on the contents of the message. In CPI, use the Router component to implement Content-based Routing.

References/Further Readings

Hope this helps,

P.S.: Alexander Bundschuh has already blogged about Content-based Routing. We both are using a similar example to demonstrate Content-based Routing in CPI. Read Alex’s blog to learn about implementing Content-based Routing in Process Orchestration as well as in CPI.

About the Author

Bhalchandra Wadekar

Bhalchandra Wadekar is an Integration Enthusiast who authored the Enterprise Integration Patterns in SAP Cloud Platform Integration (#EIPinCPI) series on SAP Blog Community. He is a fan of integration from API Management and Open Connectors to Message Based Integration and Data Integration.

More Content by Bhalchandra Wadekar
Previous Article
EIPinCPI – Pipes-and-Filters
EIPinCPI – Pipes-and-Filters

Next Article
EIPinCPI – Return Address
EIPinCPI – Return Address