You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Jahvid.Williams" <ja...@napkasystems.com> on 2009/01/14 18:15:05 UTC

PyActiveMQ: Retrieving Queue Size (Or other Queue related info)

Good Day All,

Does anyone know if it is currently possible using pyactivemq (for python
2.5) to retrieve queue information, more specifically the size of a
queue/topic? I know in java there is a QueueBrowser, however is such an
implementation readily available in the current pyactivemq, ActiveMQ-CPP.

Thanks in advance
--
Jahvid Williams
Software Developer
Napka Systems.
-- 
View this message in context: http://www.nabble.com/PyActiveMQ%3A-Retrieving-Queue-Size-%28Or-other-Queue-related-info%29-tp21460541p21460541.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: PyActiveMQ: Retrieving Queue Size (Or other Queue related info)

Posted by Timothy Bish <ta...@gmail.com>.
ActiveMQ doesn't have a QueueBrowser implementation, we'd love for
someone to contribute the code, but for right now its not supported.

Regards
Tim

On Wed, 2009-01-14 at 09:15 -0800, Jahvid.Williams wrote:
> Good Day All,
> 
> Does anyone know if it is currently possible using pyactivemq (for python
> 2.5) to retrieve queue information, more specifically the size of a
> queue/topic? I know in java there is a QueueBrowser, however is such an
> implementation readily available in the current pyactivemq, ActiveMQ-CPP.
> 
> Thanks in advance
> --
> Jahvid Williams
> Software Developer
> Napka Systems.
-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Re: PyActiveMQ: Retrieving Queue Size (Or other Queue related info)

Posted by Bill Schuller <Bi...@intuit.com>.
I think that advisory topics are going to solve for only some of your cases.
I¹m new to AMQ, so there is a little speculation involved here. If you set
up a standard topic subscriber in python on the ActiveMQ.Advisory.FULL
topic, you will receive a message every time a destination is ³full². I¹m
assuming ³full² means that the destination has met either a hard or
policy-based soft limit and is now blocking producers. In order to determine
which destination it is, you will need to access the usageName message
header property.

As for the Producer/Consumer counts, this might be tricky. From the
documentation it looks like the message body is a Java object, but the
information you¹re looking for (producer/consumer count) is in the header,
so technically you should be able to access it by subscribing to the
appropriate topics as mentioned above. You¹ll probably want to see if you
can set up a SubscriptionRecoveryPolicy on these topics so that you¹ll
always get the most recent count.

If you are looking for the current message backlog in count or size, you¹re
looking at getting into a different game. Two avenues immediately jump to
mind.

1. use the web admin interface (no personal experience) to access these
values via HTTP from python
2. write some embedded java code (camel?) that runs in the broker, queries
the admin methods and publishes messages with the information you¹re
interested in on regular intervals.

Of course, then I start to wonder if you¹re approaching this in
architecturally the right direction. Generally the producers should always
want to produce, no mater if the consumers are offline or not consuming fast
enough. Rather than tracking how much you are using, why not set soft limits
on the destination size and have your producers block? If you need to, you
can handle this by writing to an alternate store if blocked, but this can
all be done without a lick of additional code to figure out if the
destination/broker is ³full².

Just my two and a half cents.

On 1/16/09 9:09 AM, "Jahvid.Williams" <ja...@napkasystems.com>
wrote:

>     * How Many Consumers are Connected (If none, maybe pause messages,
> probably store them in  cache or something until someone is available to
> receive them)
>     * The size of a actual queue or topic (Its quite easy to crash ActiveMQ
> with a GB or more worth of messages).

---
Bill Schuller, Service Foundations Engineering, Intuit Inc.


Re: PyActiveMQ: Retrieving Queue Size (Or other Queue related info)

Posted by "Jahvid.Williams" <ja...@napkasystems.com>.
Ok thanks to both Timothy & Bill for the responses:



Bill Schuller wrote:
> 
> The QueueBrowser JMS API call is intended for browsing the content of
> messages in a queue. If you are just looking for counts of the pending
> messages in a queue/topic, I think you¹re on the wrong trail. No
> experience
> with Python or ActiveMQ-CPP, so I¹m not sure what your options are, but I
> think this link should get you headed in the right direction:
> 
> http://activemq.apache.org/how-can-i-monitor-activemq.html
> 

Ok, from what i read on the link above using advisory messages appear to be
my best bet.. however I dont see that functionality in the pyactivemq
documentation.  I could be wrong, but i have spent quite some time
researching this. 

Basically this is the scenario:

1.) There is a Game Server which uses ActiveMQ (Server sends messages to
specified queue's/topic's)
2.) There are Game Clients (Among other kinds of clients).
3.) There is a message consumer  (basically it takes the messages off the
queue and stores the necessary information in a table (db).

The Server and some of the "clients" are java based, where as others are
python based. What i need to accomplish is a way to monitor: 
    * How Many Consumers are Connected (If none, maybe pause messages,
probably store them in  cache or something until someone is available to
receive them)
    * The size of a actual queue or topic (Its quite easy to crash ActiveMQ
with a GB or more worth of messages).

What i am trying to accomplish is to find a way to do this in one of the
python clients, its somewhat of a system monitor: Monitors if AMQ is
running, consumer... stuff like that ... as well as the definite "AMQ
Resources themselves"... now after reading up on Advisory Messages if i had
a way to directly access:
  If a topic/queue is full - The link that you showed above does give some
definite suggestions (in java) for how i would do something like this. One
question that i have is, is it possible to subscribe to an advisory topic (I
personally have tried to no avail).

Given i'd like to be able to check for this advisory message if possible:
advisoryWhenFull.. "ActiveMQ.Advisory.FULL"

As well as  Accessing Consumer/Producer count via the advisory messages:
  ActiveMQ.Advisory.Producer.Queue 
  ActiveMQ.Advisory.Producer.Topic 
  ActiveMQ.Advisory.Consumer.Queue 
  ActiveMQ.Advisory.Consumer.Topic

See reference link below:
http://activemq.apache.org/advisory-message.html Advisory Message 

-----
“A foolish man tells a woman to stop talking, but a wise man tells her that
her mouth is extremely beautiful when her lips are closed”
-- 
View this message in context: http://www.nabble.com/PyActiveMQ%3A-Retrieving-Queue-Size-%28Or-other-Queue-related-info%29-tp21460541p21501488.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: PyActiveMQ: Retrieving Queue Size (Or other Queue related info)

Posted by Bill Schuller <Bi...@intuit.com>.
The QueueBrowser JMS API call is intended for browsing the content of
messages in a queue. If you are just looking for counts of the pending
messages in a queue/topic, I think you¹re on the wrong trail. No experience
with Python or ActiveMQ-CPP, so I¹m not sure what your options are, but I
think this link should get you headed in the right direction:

http://activemq.apache.org/how-can-i-monitor-activemq.html



On 1/14/09 11:15 AM, "Jahvid.Williams" <ja...@napkasystems.com>
wrote:

> 
> 
> Good Day All,
> 
> Does anyone know if it is currently possible using pyactivemq (for python
> 2.5) to retrieve queue information, more specifically the size of a
> queue/topic? I know in java there is a QueueBrowser, however is such an
> implementation readily available in the current pyactivemq, ActiveMQ-CPP.
> 
> Thanks in advance
> --
> Jahvid Williams
> Software Developer
> Napka Systems.
> --
> View this message in context:
> http://www.nabble.com/PyActiveMQ%3A-Retrieving-Queue-Size-%28Or-other-Queue-re
> lated-info%29-tp21460541p21460541.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> 

---------------------------------------------------------------
Bill Schuller, Sr. SW Engineer
Intuit, Inc.
Intuit Ecosystem Platform Service Foundations
+1-214-387-2583, bill_schuller@intuit.com <ma...@intuit.com>
5601 Headquarters Drive, Plano, TX 75024
---------------------------------------------------------------