Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: JMS Gateway Timeout

  1. #1
    Join Date
    Jan 2010
    Posts
    11

    Unhappy JMS Gateway Timeout

    Hello,

    I am using the JMS Outbound Gateway to send messages from a client to the server. To keep it simple I set up one Queue for the requests. The gateway is set up so that the answer will be sent through a special Queue for each client.

    Example:
    Client A:
    Code:
    <int-jms:outbound-gateway id="jmsout"
      request-channel="toJmsChannel"
      reply-channel="jmsReplyChannelUnfiltered"
      request-destination="requestQueue"
      reply-destination="clientAQueue"/>
    Client B:
    Code:
    <int-jms:outbound-gateway id="jmsout"
      request-channel="toJmsChannel"
      reply-channel="jmsReplyChannelUnfiltered"
      request-destination="requestQueue"
      reply-destination="clientBQueue"/>
    The server receives the requests through a JMS Inbound Gateway.
    Code:
    <int-jms:inbound-gateway id="jmsin"
     request-destination="requestQueue"
     request-channel="fromJmsChannel" />
    When I run this configuration everything works fine except Spring does not close the connection to the client Queue on the client side after receiving and processing the message.

    Is there a chance to close these connections? I am afraid of killing my ActiveMQ server with too many consumers on the client queues.

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

    Default

    In the JMS OutboundGateway, there is a finally block with this:
    Code:
    JmsUtils.closeMessageConsumer(messageConsumer);
    Is there any chance you could run with a debugger and a breakpoint there?

    Thanks,
    -Mark

  3. #3
    Join Date
    Jan 2010
    Posts
    11

    Default

    I did try it but the debugger does not reach the breakpoint.

  4. #4
    Join Date
    Jan 2010
    Posts
    11

    Default

    sorry, I tried to increase the receive-timeout and so everything went wrong .. now I am reaching the breakpoint ... what values do you need?

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

    Default

    Actually, can you describe the behavior that you are seeing?... I believe it's simply caching Consumers since that is the default behavior of DefaultMessageListenerContainer. You should not see the number grow beyond the number of concurrent consumers at any given time (and that can be controlled via configuration).

  6. #6
    Join Date
    Jan 2010
    Posts
    11

    Default

    Thanks for your reply.

    The Client is behaving like this: every time I place a request to the server the response increases the number of consumers of the client queue.
    So far I did the whole procedure until I reached a number of 30 consumers on one queue.

    I did not find the right point to set a border for that. Where can I find it?

  7. #7
    Join Date
    Jan 2010
    Posts
    11

    Default

    thank you for your advise. I checked my connectionFactory settings and found out how to stop caching. Now everything works fine. The only question is if I can set the number of cached consumers. In this case I would be able to enable caching but with a fixed number of cached instances.

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

    Default

    Can you try setting the 'concurrent-consumers' value on the gateway element?

  9. #9
    Join Date
    Jan 2010
    Posts
    11

    Default

    I can only set the concurrent-consumers on the inbound gateway of the server so I think that this will not fix my problem. But the other option is fine for me.

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

    Default

    Sorry. You're right... I was thinking about the wrong side

    So, are you saying that everything is okay now that you've configured your ConnectionFactory?

Tags for this Thread

Posting Permissions

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