This week, we’ll study a pattern known as Point-to-Point Channel.
When do I use this pattern?
A Point-to-Point channel is used when the sender intends to send the message to exactly one receiver. For example, sending orders from Order Management System to an Enterprise Resource Planning system. In this example, the receiver is only one – ERP system. When multiple receivers are involved, a Point-to-Point channel ensures that only one receiver receives the message.
Point-to-Point Channel in CPI
In CPI, I’ll use JMS Sender Adapter and JMS Receiver Adapter to demonstrate the pattern. Let’s use Northwind OData Service to act as Order Management System. Also, instead of sending the order to an actual ERP System, I’ll simply log the payload.
Integration Flow – Sending an Order to the Channel
Sending an Order to the Channel
The Integration Flow starts with a Timer Start Event, gets the Order from Northwind OData Service using a Request-Reply component and OData Receiver Adapter. Finally, the Order is sent to a Point-to-Point channel using JMS Receiver Adapter.
Configuration of OData Receiver Adapter:
Configuration of JMS Receiver Adapter:
Integration Flow – Receiving an Order from the Channel
Receiving an Order from the Channel
The integration flow picks up the Order from the channel and logs for monitoring.
The JMS Sender Adapter is configured as follows:
I am setting the Number of Concurrent Processes to 2 to demonstrate that the Order gets logged only once.
The first flow puts the Order message in the queue like so:
Sending to the Channel
Although the second flow has Competing Consumers, the message is only logged once.
Receiving from the Channel
EIPinCPI Rating – 10/10
The EIPinCPI rating of 10 out of 10 is justified by the strong support for JMS in CPI. The rating is the same as that for Message Channel pattern.
Point-to-Point channel is used when the sender intends to send the message to exactly one receiver. CPI supports the patterns through JMS.
Hope this helps,
About the Author
More Content by Bhalchandra Wadekar