On Thu, 2012-04-12 at 05:47 -0700, sreekar wrote:
> 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
> session
> (with which ActiveMQConsumer is created).....right ?
>
> If i want a total count of the messages in the queue, i am thinking of the
> following:
> [[ 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 this.....i.e...to 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,
> Sreekar
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Check-for-pending-queue-messages-tp4551751p4551751.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
One way to get Broker side info in CMS is to use the
StatisticsBrokerPlugin, see:
http://activemq.apache.org/statisticsplugin.html
You can also use Advisories to collect some information from the Broker:
http://activemq.apache.org/advisory-message.html
--
Tim Bish
Sr Software Engineer | FuseSource Corp
[email protected] | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/