activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sreekar <>
Subject Check for pending queue messages...?
Date Thu, 12 Apr 2012 12:47:02 GMT
Hi Guys,

In Active-MQ CMS, is there any direct way to know the number of messages
ready-to-be-consumed ?

Currently, i found the following when searching in the CPP code:
int ActiveMQConsumer::getMessageAvailableCount() const {
    return this->internal->unconsumedMessages->size();

I guess this is the count of msgs-ready-to-be-consumed of a particular
(with which ActiveMQConsumer is created).....right ?

If i want a total count of the messages in the queue, i am thinking of the
[[ I have a map of all the producers that are sending messages to a queue ]]
-> create a temporary ActiveMQConsumer. (using the session with which
producer is created)
-> call above function, get size (accumulate with prev. count)
-> destroy the ActiveMQConsumer
-> repeat above 3 steps  for all producers.

Is there any better (efficient) way to get the message-count (enqueued but
not dequeued) from C++ API ?

bool ActiveMQQueueBrowser::hasMoreMessages()
               if( this->browser->getMessageAvailableCount() > 0 ) {
                return true;

ActiveMQQueueBrowser also seems to send TRUE/FALSE on a per session basis.

In the web-console, when i run the examples, i can see the count of, number
of messages-enqueued and number of messages dequeued.

I guess there might be some variable/function-call from where it is getting
those values, which i am currently not able to figure out.

Can anyone help me regards get the  count =
(messages_enqueued - message_dequeued) from within C++ API ?

[[ The code flow varies based upon this.......i.e whenever the count >
(prefetch_limit...or...Q_size_set) ]]

Any help would be appreciable.

Thanks & Regards,

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message