I am trying to wire up a gateway.
I have the following working:
(NB: this is with Grails' "Spring Beans DSL")Code:jmsGateway(org.springframework.integration.gateway.SimpleMessagingGateway) { requestChannel = ref("routerChannel") replyChannel = ref("ShippingCostChannel") replyTimeout = "10000" }
I am interacting with this in a Grails controller as follows:
If I try to use a gateway using GatewayProxyFactoryBean, I get errors.Code:def send = { def msg = params.content jmsGateway.send(msg) println "Sending '$msg'" def got = jmsGateway.receive() //def got = '???' println "RECEIVED: '$got'" flash.message = got }
In the new controller:Code:gateway(id: "lookupService", "service-interface": "au.com.transentia.si.LookupService", "default-request-channel": "routerChannel", "default-reply-channel": "ShippingCostChannel", "default-reply-timeout": "10000")
LookupService is:Code:def send = { def msg = params.content flash.message = lookupService.lookup(msg) }
Here is a debug trace for the relevant part of the execution:Code:package au.com.transentia.si public interface LookupService { String lookup(String who) }
It seems that postSend on the 'ShippingCostChannel' is not resolving correctly in this case...but it DOES if I use the SimpleMessagingGateway "by hand"...Code:2009-04-10 11:10:45,511 [task-scheduler-3] DEBUG channel.QueueChannel - preSend on channel 'ShippingCostChannel', message: [Payload=<?xml version="1.0" encodin g="UTF-8"?><ns1:calculateShippingCostResponse xmlns:ns1="http://DefaultNamespace "><ns1:return>0.0</ns1:return></ns1:calculateShippingCostResponse>][Headers={spr ingintegration_jms_messageId=ID:TRIFFID-49578-1239324670371-0:0:2:1:2, springint egration_timestamp=1239325845406, springintegration_id=0d7c3d9a-a3a7-4516-9841-6 951d3779bf5, springintegration_jms_redelivered=false}] 2009-04-10 11:10:45,511 [task-scheduler-3] DEBUG channel.QueueChannel - postSen d (sent=true) on channel 'ShippingCostChannel', message: [Payload=<?xml version= "1.0" encoding="UTF-8"?><ns1:calculateShippingCostResponse xmlns:ns1="http://Def aultNamespace"><ns1:return>0.0</ns1:return></ns1:calculateShippingCostResponse>] [Headers={springintegration_jms_messageId=ID:TRIFFID-49578-1239324670371-0:0:2:1 :2, springintegration_timestamp=1239325845406, springintegration_id=0d7c3d9a-a3a 7-4516-9841-6951d3779bf5, springintegration_jms_redelivered=false}] 2009-04-10 11:10:45,511 [task-scheduler-4] DEBUG channel.QueueChannel - postRec eive on channel 'ShippingCostChannel', message: [Payload=<?xml version="1.0" enc oding="UTF-8"?><ns1:calculateShippingCostResponse xmlns:ns1="http://DefaultNames pace"><ns1:return>0.0</ns1:return></ns1:calculateShippingCostResponse>][Headers= {springintegration_jms_messageId=ID:TRIFFID-49578-1239324670371-0:0:2:1:2, sprin gintegration_timestamp=1239325845406, springintegration_id=0d7c3d9a-a3a7-4516-98 41-6951d3779bf5, springintegration_jms_redelivered=false}] 2009-04-10 11:10:45,514 [task-scheduler-4] DEBUG gateway.AbstractMessagingGatewa y$1 - org.springframework.integration.gateway.AbstractMessagingGateway$1@cead6 received message: [Payload=<?xml version="1.0" encoding="UTF-8"?><ns1:calculateS hippingCostResponse xmlns:ns1="http://DefaultNamespace"><ns1:return>0.0</ns1:ret urn></ns1:calculateShippingCostResponse>][Headers={springintegration_jms_message Id=ID:TRIFFID-49578-1239324670371-0:0:2:1:2, springintegration_timestamp=1239325 845406, springintegration_id=0d7c3d9a-a3a7-4516-9841-6951d3779bf5, springintegra tion_jms_redelivered=false}] 2009-04-10 11:10:45,515 [task-scheduler-4] DEBUG channel.PublishSubscribeChannel - preSend on channel 'errorChannel', message: [Payload=org.springframework.int egration.channel.ChannelResolutionException: unable to resolve reply channel for message: [Payload=<?xml version="1.0" encoding="UTF-8"?><ns1:calculateShippingC ostResponse xmlns:ns1="http://DefaultNamespace"><ns1:return>0.0</ns1:return></ns 1:calculateShippingCostResponse>][Headers={springintegration_jms_messageId=ID:TR IFFID-49578-1239324670371-0:0:2:1:2, springintegration_timestamp=1239325845406, springintegration_id=0d7c3d9a-a3a7-4516-9841-6951d3779bf5, springintegration_jms _redelivered=false}]][Headers={springintegration_timestamp=1239325845515, spring integration_id=68f36a77-69cc-41fa-9bae-58c2e941ab1a}] org.springframework.integration.channel.ChannelResolutionException: unable to re solve reply channel for message: [Payload=<?xml version="1.0" encoding="UTF-8"?> <ns1:calculateShippingCostResponse xmlns:ns1="http://DefaultNamespace"><ns1:retu rn>0.0</ns1:return></ns1:calculateShippingCostResponse>][Headers={springintegrat ion_jms_messageId=ID:TRIFFID-49578-1239324670371-0:0:2:1:2, springintegration_ti mestamp=1239325845406, springintegration_id=0d7c3d9a-a3a7-4516-9841-6951d3779bf5 , springintegration_jms_redelivered=false}] at org.springframework.integration.handler.AbstractReplyProducingMessage Handler.resolveReplyChannel(AbstractReplyProducingMessageHandler.java:142) at org.springframework.integration.handler.AbstractReplyProducingMessage Handler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:102) ...
Any suggestions/thoughts?
Cheers,
Alph


Reply With Quote
