Skip to Content
Technical Articles
Author's profile photo Bhalchandra Wadekar

EIPinCPI – Content-based Router

Previous – Message Router | Index | Next – Message Filter

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:

<Delivery>
	<Country>UK</Country>
</Delivery>

Input 2:

<Delivery>
	<Country>India</Country>
</Delivery>

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

Conclusion

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,
Bala

P.S.: Alex 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.

Previous – Message Router | Index | Next – Message Filter

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.