View Full Version : what different between message-driven-channel-adapter and jms:inbound-gateway
loveam
Dec 1st, 2009, 03:25 AM
hi,all:
after read SI reference, I am confuse about it.
according the document, it looks "jms:message-driven-channel-adapter" and "jms:inbound-gateway" doing a same thing.
Mark Fisher
Dec 1st, 2009, 06:57 AM
The difference is that any "-channel-adapter" in Spring Integration is *one way* while any "gateway" adapter supports *request/reply*. So, for example, when using the JMS "inbound-gateway", any JMS client can send a Message that has a JMSReplyTo property and expect a response on the Destination as long as the Spring Integration Message flow that begins with that adapter does in fact generate a response.
loveam
Dec 1st, 2009, 07:17 PM
thank you very much
Grzegorz Grzybek
Dec 2nd, 2009, 12:24 AM
Hi
And in code it looks like this:
this.registerBeanDefinitionParser("inbound-gateway", new JmsMessageDrivenEndpointParser(true));
this.registerBeanDefinitionParser("message-driven-channel-adapter", new JmsMessageDrivenEndpointParser(false));
The boolean flag is used to set expectReply property.
When the listener receives incoming JMS message, "inbound-gateway" sends it to the channel ("pulls" it into Spring-Integration) using:
this.channelTemplate.send(requestMessage)
"message-driven-channel-adapter" uses:
this.channelTemplate.sendAndReceive(requestMessage )
which may block when you are not going to reply to JMS message (which is common in case JMS is used as some kind of notification service).
regards
Grzegorz Grzybek
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.