ActiveMQ Messages Stuck in Pending State

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ Messages Stuck in Pending State

muralidhar.koyya
Hi,
I have seen several threads on this subject. But couldn't get some basic
information on why messages goes into pending state.

Some background:
We are using ActiveMQ 5.X. Below are the properties taken from JMX console
for a durable consumer.

Active - TRUE
Client - MessagingClient.XXX
Connection - undefined
Connection - ID:<consumer-server>-<number-ID>:1
Consumed count - 0
Cursor full - FALSE
Cursor memory usage - 200376888
Cursor percent usage - 18
Dequeue counter - 236507
Destination name - <des-name>
Destination queue - FALSE
Destination temporary - FALSE
Destination topic - TRUE
Dispatched counter - 236528
Dispatched queue size - 0
Durable - TRUE
Enqueue counter - 286298
Exclusive - FALSE
Maximum pending message limit - 0
Message count awaiting acknowledge - 0
Network - FALSE
No local - TRUE
Object Name -
org.apache.activemq:type=Broker,brokerName=broker,destinationType=Topic,destinationName=EllipseServices,endpoint=Consumer,clientId=MessagingBridge.EllipseServicesBridge,consumerId=Durable(MessagingBridge.EllipseServicesBridge_EllipseServicesBridge)
*Pending queue size - 53842*
Prefetch size - 100
Priority - 0
Retroactive - FALSE
Selector - service in ('XYZ') OR table in ('ABC')
Session - 2
Slow consumer - FALSE
Subcription - 1
Subcription name - <sub-name>
Subscription - 1
Subscription name - <sub-name>
User name -

Have few basic questions on pending messages.

1. What causes the messages in ActiveMQ topic go into pending state?

Our observations: We have seen pending messages when we have a slow
subscriber or more number of messages (in several thousands) are created by
broker in short span of time.

2. Does inactivity of the durable consumer cause the messages getting into
pending state? What happens if we disableInactivity Monitoring with a
consumer? Hope this forces the connection to keep alive with consumer all
the time. Is there any negative impact with the setting on consumer/client?

3. Are there any ActiveMQ server/client configurations which could avoid
messages getting into pending state?

4. How can we access the messages (content) when messages goes into pending
state? JMX console only provides the number/count of messages?

Would really appreciate any inputs.

Best Regards
Murali



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ Messages Stuck in Pending State

Tim Bain
On Dec 3, 2017 11:50 AM, "muralidhar.koyya" <[hidden email]>
wrote:

Hi,
I have seen several threads on this subject. But couldn't get some basic
information on why messages goes into pending state.

Some background:
We are using ActiveMQ 5.X. Below are the properties taken from JMX console
for a durable consumer.

Active - TRUE
Client - MessagingClient.XXX
Connection - undefined
Connection - ID:<consumer-server>-<number-ID>:1
Consumed count - 0
Cursor full - FALSE
Cursor memory usage - 200376888
Cursor percent usage - 18
Dequeue counter - 236507
Destination name - <des-name>
Destination queue - FALSE
Destination temporary - FALSE
Destination topic - TRUE
Dispatched counter - 236528
Dispatched queue size - 0
Durable - TRUE
Enqueue counter - 286298
Exclusive - FALSE
Maximum pending message limit - 0
Message count awaiting acknowledge - 0
Network - FALSE
No local - TRUE
Object Name -
org.apache.activemq:type=Broker,brokerName=broker,destinatio
nType=Topic,destinationName=EllipseServices,endpoint=Consume
r,clientId=MessagingBridge.EllipseServicesBridge,consumerId=
Durable(MessagingBridge.EllipseServicesBridge_EllipseServicesBridge)
*Pending queue size - 53842*
Prefetch size - 100
Priority - 0
Retroactive - FALSE
Selector - service in ('XYZ') OR table in ('ABC')
Session - 2
Slow consumer - FALSE
Subcription - 1
Subcription name - <sub-name>
Subscription - 1
Subscription name - <sub-name>
User name -

Have few basic questions on pending messages.

1. What causes the messages in ActiveMQ topic go into pending state?


Pending messages are messages that have been enqueued (sent) but not
dequeued (consumed or expired). If you have a large number of pending
messages, your consumer is either too slow or is/was offline. Or it's not
acking messages; is this consumer using something other than AUTO_ACK?

Our observations: We have seen pending messages when we have a slow
subscriber or more number of messages (in several thousands) are created by
broker in short span of time.


Yes, exactly.

2. Does inactivity of the durable consumer cause the messages getting into
pending state?


Yed.

What happens if we disableInactivity Monitoring with a
consumer?


The inactivity monitor detects when the consumer is connected but not
sending bytes on the connection to the broker. This could be relevant if
your consumer takes a very long time to consume a single message (and that
is normal/expected), but otherwise it'll have no effect.

Hope this forces the connection to keep alive with consumer all
the time.


It sounds like you think it does something other than what it actually
does. This sounds like a dead end; it sounds like your consumer is simply
not running, so you need to figure out why and fix it. Or maybe it's OK
that it's (temporarily) not running, and you just need to wait for the
consumer to reconnect and consume the messages.

Is there any negative impact with the setting on consumer/client?


No.

3. Are there any ActiveMQ server/client configurations which could avoid
messages getting into pending state?


Yes, make sure your consumers are always connected and processing data.

4. How can we access the messages (content) when messages goes into pending
state? JMX console only provides the number/count of messages?


For queues, you can browse the messages on the web console without
affecting the real consumer, but I'm not aware of a way to do it directly
for a topic. If you're willing to have the consumer lose the messages, you
could apply a pending message limit strategy (see
http://activemq.apache.org/slow-consumer-handling.html) to force them into
the DLQ, then use the web console to view them. Or you could switch to a
JDBC message store, allowing you to view the pending messages via SQL
queries, but that's a drastic step and won't help you see the current
messages.

Would really appreciate any inputs.

Best Regards
Murali



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html