Skip to Content
Technical Articles

EIPinCPI – Message Dispatcher

Previous – Competing Consumers | Index | Next – Selective Consumer

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

Previous – Competing Consumers | Index | Next – Selective Consumer

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