No matter how much I read about those two patterns I just can't see the difference.
That's a great question since they are similar in that they provide an application access to a messaging system. It is how they acheive it I think that differentiates them.
The Channel Adapter pattern deals how to get data from an existing system without modifying that system. Typically the Channel Adapdter is implemented out-of-process. Examples often seen are a program that periodically walks an underlying database to find things to enqueue. Of perhaps a stand-alone app that calls a remoting or HTTP API to access a systems data to create messages. The point being, that the non-messaging system is completely unmodified.
I think Message Gateway is more intended for in-process messaging integration. It is really about applying good OO encapsulation around the message subsystem. Perhaps some object in the system is called WorkOrderSender with a method called Send(WorkOrder wo). The implementation of that class shields the application from any details of messaging...to it the call is just another method call. In fact, it should be possible to swap out your messaging vendor or even trade messaging for HTTP or FTP etc.
From Spring integration reference docs:
Whereas the JMS Channel Adapters are intended for unidirectional Messaging (send-only or receive-only), Spring Integration also provides inbound and outbound JMS Gateways for request/reply operations.
See http://static.springsource.org/spring-integration/reference/htmlsingle/#jms
From the documentation:
- Inbound channel adapters are used for one-way integration to bring data into the messaging application.
- Outbound channel adapters are used for one-way integration to send data out of the messaging application.
- Inbound gateways are used for a bidirectional integration flow, where some other system invokes the messaging application and receives a reply.
- Outbound Gateways are used for a bidirectional integration flow, where the messaging application invokes some external service or entity and expects a result.
© 2022 - 2024 — McMap. All rights reserved.