-
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.
-
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
-
I did try it but the debugger does not reach the breakpoint.
-
sorry, I tried to increase the receive-timeout and so everything went wrong .. now I am reaching the breakpoint ... what values do you need?
-
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).
-
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?
-
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.
-
Can you try setting the 'concurrent-consumers' value on the gateway element?
-
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.
-
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?