Skip to Content
Technical Articles

EIPinCPI: Dynamic Router

Previous: Message Filter | Index | Next: Recipient List

This week, we’ll study another variation of Message Router known as Dynamic Router.

When do I use this pattern?

This pattern is used when routing rules are provided by recipients dynamically rather than configured in the Router. This means that the decision to receive a message or not is up to the receiver.

Unfortunately, there is no out of the box way to implement dynamic routing. CPI would require key-value storage that can be updated programmatically. Value Mapping is CPI’s key-value storage, however, it is not configurable dynamically using published APIs. One may need to dive deep into Integration Content APIs to find a solution.

The next best way to achieve this pattern is to design the routing condition to be dynamically evaluated. For example, a routing where IDocs are dynamically sent to Receivers based on their message type.

Dynamic Router in CPI

In SAP Cloud Platform Integration, the dynamic evaluation of routing condition can be achieved using ProcessDirect Adapter. In particular, we’ll be exploring Dynamic Endpoint feature of ProcessDirect.

For the demonstration, consider that customer master information needs to be sent to the CRM system whereas delivery information needs to be sent to the delivery system, however, both originate from a single system.

Integration Flow

1. Receive the IDoc from ECC

 

Here, the ProcessDirect’s Address field is configured to be ‘/ECC/${header.SapIDocType}’. As the value of IDoc Type is referred from a header set by IDoc Adapter, the decision to process a certain IDoc is left to the receiver.

2.a Handle Customer Master

Here, the Address parameter of ProcessDirect is configured to be ‘/ECC/DEBMAS07’. This integration flow will process DEBMAS07 IDoc and send it to the CRM system.

2.b Handle Delivery

Here, the Address parameter of ProcessDirect is configured to be ‘/ECC/DELVRY07’. This integration flow will process DELVRY07 IDoc and send it to the delivery system.

IMHO

As I am writing this blog, I believe the use of Dynamic Endpoint feature of ProcessDirect Adapter does not implement the Dynamic Router as explained in the book Enterprise Integration Patterns. However, it is the next best thing. What do you think? Do you have ideas around the implementation of Dynamic Router in CPI? Comment below to share your experience or write a blog explaining the implementation of Dynamic Router in CPI.

Conclusion

Dynamic Router is said to be used when the router is dynamically configured by participating receivers. We explored two ProcessDirect receivers being called dynamically using Simple Expression. In CPI, the dynamic router cannot be implemented exactly as explained in the book Enterprise Integration Patterns.

References/Further Readings

Hope this helps,
Bala

Previous: Message Filter | Index | Next: Recipient List

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