Previous – Message Channel | Index | Next – Publish-Subscribe Channel
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:
Tab |
Property |
Value |
Processing |
Queue Name |
Orders |
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:
Tab |
Property |
Value |
Connection |
Queue Name |
Orders |
Connection |
Number of Concurrent Processes |
2 |
I am setting the Number of Concurrent Processes to 2 to demonstrate that the Order gets logged only once.
Output
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.
Conclusion
Point-to-Point channel is used when the sender intends to send the message to exactly one receiver. CPI supports the patterns through JMS.
References/Further Readings
Hope this helps,
Bala
Previous – Message Channel | Index | Next – Publish-Subscribe Channel