0
votes

We have a use case wherein we create just one consumer to process messages in the Queue. Message processor accumulates certain number of messages before acknowledging. Receiving messages in Asynchronous way and using Transacted session. Size of message is very small.

Active MQ stops sending further messages to sole consumer after certain number of messages and waits for acknowledgement. We have tried solutions like consumer.prefetchSize, consumer.maximumPendingMessageLimit; but nothing is working. We tried similar use case with a durable topic with just one subscriber and it works fine.

Has anyone encountered similar activemq issue/behavior? We tried many things mentioned on different forums but none of them helped.

Activemq version : ActiveMQ 5.6.0
Queue configuration : Durable queue
Consumer : Asynchronous and uses transacted session as acknowledgement mode

Any help or suggestion will be greatly appreciated. Thanks.

1
Please show the code where the QueueSession is opened. And the code where you call commit on the QueueSession. How long does it take, starting from the 1st read until the commit?Beryllium
I forgot: How is the session is closed (both in normal case, and in case of an exception)Beryllium
It would be difficult for me to past the entire code over here as it is too large/complex and pasting just code snippet wont make any difference in understanding my problem. When I create a consumer of the queue I open the session and close the session when stop request is received.Ankur Shanbhag
Moreover,the time taken to commit the session is not fixed,it depends on the number of messages received. When desired number of messages are received, we call commit on the session instance. This approach works fine as long as I commit small batch of messages. But as soon as I start accumulating larger no. of messages without acknowledging, activemq stops sending further messages after a certain point and waits for acknowledgement.What configurations changes needs to be done to overcome this?Moreover,this approach works fine when I replace queue with topic,it sends messages and does not wait.Ankur Shanbhag
Can you please start up a clean ActiveMQ instance, that is one that has accepted no messages. Set up the consumer and start publishing messages to the queue. Keep publishing until your consumer stops receiving messages. Next, go into JMX via JConsole or JVisualVM and in the tree for the process go to org.apache.activemq/<brokerName>/Queue/<yourQueue>. Please post up the values for DequeueCount, DispatchCount, EnqueueCount and MemoryLimit and MemoryPercentPortion. Can you also please attach any messages that ActiveMQ may be logging to the console.Jakub Korab

1 Answers

1
votes

I had tried out lot of different configurations to resolve this issue by setting different activemq attributes like prefetch policy, maxpagesize etc. but none of them really helped. By referring to @Jake's comment I got to know about monitoring activemq using JMX via JConsole. This is a very handy tool to monitor and manage your activemq. Here are few article which you may find useful.
1. Monitoring activemq
2. Connecting activemq JMX using JConsole

By monitoring the queue attributes I figured out that memoryLimit attribute had very low value assigned to it (just 1mb). Increasing the value of the attribute solved my issue. JMS started sending messages without waiting for acknowledgement.

For testing purpose I had changed the value for memoryLimit in the conf/activemq.xml configuration file.