İlkay Gunel
İlkay Gunel

Reputation: 852

Spring JMS - Message-driven-channel-adapter The number of consumers doesn't reduce to the standard level

I have a message-driven-channel-adapter and I defined the max-concurrent-consumers as 100 and concurrent-consumers as 2. When I tried a load test, I saw that the concurrent-consumers increased but after the load test, The number of consumers didn't reduce to the standard level. I'm checking it with RabbitMQ management portal.

When the project restarted (no load test), the GET (Empty) is 650/s but after load test it stays about 2500/s. It is not returning to 650/s. I think concurrent-consumers property is being increased to a number but is not being reduced to original value. How can I make it to reduce to normal level again? Here is my message-driven-channel-adapter definition:

<int-jms:message-driven-channel-adapter  id="inboundAdapter"
                                         auto-startup="true"
                                         connection-factory="jmsConnectionFactory"
                                         destination="inboundQueue"
                                         channel="requestChannel"
                                         error-channel="errorHandlerChannel"
                                         receive-timeout="-1"
                                         concurrent-consumers="2"
                                         max-concurrent-consumers="100" />

Upvotes: 0

Views: 232

Answers (1)

Gary Russell
Gary Russell

Reputation: 174494

With receiveTimeout=-1; the container has no control over the idle consumer (it is blocked in the jms client).

You also need to set max-messages-per-task for the container to consider stopping a consumer.

<int-jms:message-driven-channel-adapter  id="inboundAdapter"
                                         auto-startup="true"
                                         connection-factory="jmsConnectionFactory"
                                         destination-name="inboundQueue"
                                         channel="requestChannel"
                                         error-channel="errorHandlerChannel"
                                         receive-timeout="5000"
                                         concurrent-consumers="2"
                                         max-messages-per-task="10"
                                         max-concurrent-consumers="100" />

The time elapsed for an idle consumer is receiveTimeout * maxMessagesPerTask.

Upvotes: 0

Related Questions