Results 1 to 10 of 18

Thread: Outbound Gateway Dilemma

Hybrid View

  1. #1
    Join Date
    Jun 2010
    Posts
    17

    Default Outbound Gateway Dilemma

    I am using a using an outbound gateway in a request/reply scenario. I am able to send one request and receive the reply. Efforts to send a second request results in a MessageTimeoutException.

    The server, using an inbound-gateway, chain and service activator appears to work fine. In fact, the second reply is on the message queue waiting to be read by the client but for some reason the inbound-gateway isn't picking it up.

    I use a ChannelResolver to obtain a MessageChannel which I then use to send a message.

    The fact that I am able to consistently receive the first reply would seem to suggest that the wiring of the components is basically correct.

    Should a be able to use the same message channel to send multiple messages? Is there some setting that is necessary for this scenario to work?

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Are you talking about JMS gateways? Can you provide some configuration excerpts?

  3. #3
    Join Date
    Jun 2010
    Posts
    17

    Default

    Hi Mark! Yes, I'm using JMS. Here are the configuration elements:

    Server side (inbound-gateway):

    Code:
    <beans:bean id="manager" class="business.Manager"/>
    
    <jms:inbound-gateway id="jmsin" request-destination="some.queue" request-channel="jmsinputchannel"/>
    
    <chain input-channel="jmsinputchannel">
         <transformer id="xml-to-object" ref="marshaller" method="unmarshal" />
         <service-activator ref="manager" method="process" />
         <transformer id="object-to-xml" ref="marshaller" method="marshal" />
    </chain>
    Client side (outbound-gateway):
    Code:
    <gateway id="someService" service-interface="services.SomeService" 
                      default-request-channel="someServiceRequestChannel" 
                      default-reply-channel="someServiceReplyChannel"/>
    
    <channel id="someServiceRequestChannel"/>
    
    <jms:outbound-gateway request-channel="someServiceRequestChannel"
                         request-destination="some.queue"
                         reply-destination="some.other.queue" 
                         reply-channel="someServiceReplyChannel"/>
    
    <channel id="someServiceReplyChannel"/>
    Thanks!
    Edit/Delete Message

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    The problem is in your configuration. You are creating a conflict when pointing to the same channel while defining default-reply-channel on Gateway and reply-channel on OutboundMessageGateway.
    Basically your two Gateway are listening on the same channel.

    Modify your server configuration as follows:
    Code:
    <gateway id="someService" service-interface="services.SomeService" 
                      default-request-channel="someServiceRequestChannel" 
                      default-reply-channel="someServiceReplyChannel"/>
    
    <channel id="someServiceRequestChannel"/>
    
    <jms:outbound-gateway request-channel="someServiceRequestChannel"
                         request-destination="some.queue"
                         reply-destination="some.other.queue"/>
    
    <channel id="someServiceReplyChannel"/>
    Note how JmsOutboundGateway configuration does not have an reply-channel anymore. A temporary channel will be created from which the message will be picked up by the main Gateway.

    Let me know how.

  5. #5
    Join Date
    Jun 2010
    Posts
    17

    Default

    Hi Oleg,

    Thanks for your reply. I did what you suggested and, unfortunately, got the same results. I originally did not have the gateway but only the jms:outbound-gateway and got the timeout every time I made a second request.

    The client code uses the service interface to call the remote service twice. If I remove all of the business logic on the server and simply have the server echo the message the exception still occurs on the second request/response cycle.

    If I code the client to send only one message and terminate no exception is thrown. If I run the client multiple times in succession sending only one message each time, leaving the server on the entire time, there are no problems. As soon as I have the client send two (or more) messages during one run, the exception occurs. I'm thinking that the client is not releasing some resource but don't have an idea of what that might be. It seems that the service side is working fine.
    Last edited by w2m; Jun 15th, 2010 at 04:43 PM.

  6. #6
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Can you provide the revised configuration?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •