What is the difference between a channel adapter and a messaging gateway pattern?
Asked Answered
D

3

46

No matter how much I read about those two patterns I just can't see the difference.

Denominator answered 10/11, 2011 at 20:6 Comment(0)
T
21

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.

Trull answered 11/11, 2011 at 13:1 Comment(1)
If @Denominator is referring to the patterns as described in the Enterprise Integration Patterns book by Hohpe and Woolf, then I agree. Other definitions may vary (see the Spring reference by emush below). In cases where I have implemented these patterns I have actually used the Messaging Gateway within a Channel Adapter to abstract the underlying messaging system the same way I do within an application.Townspeople
B
4

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

Brown answered 9/12, 2011 at 14:42 Comment(1)
Link is not foundAday
P
2

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.
Piracy answered 10/2, 2021 at 12:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.