EIPinCPI – Message Dispatcher

December 15, 2019 Bhalchandra Wadekar

This week, we’ll study a pattern known as Message Dispatcher.

When do I use this pattern?

Message Dispatcher is required to coordinate between Competing Consumers when the consumers are not interchangeable. Interchangeable consumers would basically have the same code or are able to redirect the message to appropriate peer consumer for processing. We looked at creating Competing Consumers having the same code in the previous blog. In this blog, we’ll see how to create a message dispatcher to coordinate between Competing Consumers that do not have the same code.

Message Dispatcher in CPI

For the demonstration, consider that IDocs sent by the ECC system get enqueued in ‘IDocs’ queue before processing. A message dispatcher reads from the queue and invokes the performer of individual IDocs.

IDoc Producer

Get%20IDocs

Get IDocs

This integration flow receives the IDocs from ECC and enqueues them into the ‘IDocs’ queue.

Message Dispatcher

Dispatch%20IDocs

Dispatch IDocs

This integration flow acts as a Message Dispatcher. It consumes the message from ‘IDocs’ queue and triggers relevant flow using ProcessDirect Receiver Adapter based on the IDoc Type.

Here, the Address in ProcessDirect is configured to /ECC/${header.SapIDocType}.

Note that this implementation of message dispatcher dispatches the messages based on the message type alone. The load on individual performers is not controlled in the dispatcher.

Performer(s)

Customer Master

Customer%20Master%20Performer

Customer Master Performer

For the simplicity of the blog, the Performer of the Customer Master simply forwards the IDoc to the CRM system.

Delivery

Delivery%20Performer

Delivery Performer

Similar to Customer Master Performer, Delivery Performer forwards the message to Delivery System.

Conclusion

Message Dispatcher acts as a coordinator between Competing Consumers when Consumers are not interchangeable.

References/Further Readings

Hope this helps,
Bala

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 – Message Channel
EIPinCPI – Message Channel

Next Article
EIPinCPI – Selective Consumer
EIPinCPI – Selective Consumer