Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 234
Pillblast Avatar asked Nov 10 '11 20:11

Pillblast


People also ask

What is messaging Gateway in Spring Integration?

A gateway hides the messaging API provided by Spring Integration. It lets your application's business logic be unaware of the Spring Integration API. By using a generic Gateway, your code interacts with only a simple interface.

What is inbound channel adapter?

An inbound-channel-adapter element (a SourcePollingChannelAdapter in Java configuration) can invoke any method on a Spring-managed object and send a non-null return value to a MessageChannel after converting the method's output to a Message .

What is outbound Gateway in Spring Integration?

The outbound Gateway creates JMS Messages from Spring Integration Messages and then sends to a 'request-destination'.


1 Answers

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.

like image 192
tcarvin Avatar answered Oct 20 '22 00:10

tcarvin