Reputation: 183
When logging into the web management tool a queue with an "active connection" shows a status of "Active" in the details section of the queue. Note that the notion of active connection is my own since I am simply polling this queue through a web service API from a client over the web I do not have a persistent connection. The major question is how can one retrieve this status programmatically ? I am using Java (Spring AMQP) but I can dive back down into the rabbit java api if needed.
I have also looked at the HTTP API but it does not have a direct match to the "Status: Active" display in the HTTP management portal as far as I can tell.
Upvotes: 3
Views: 7525
Reputation: 183
After some digging I found that you can find if a queue is idle by looking at the HTTP api result. If the result for a queue has a the field "idle_since" then the queue is idle if the field is not present the queue is active.
In my case I was looking to determine "presence" of a user based on queue activity and this field does not provide that information. This field is reflecting the fact that "something" happened recently (queues are marked idol to conserve memory in the broker). The "something" noted above could be a client accessing the queue which would be fine in my case but could also be a monitoring tool calling list_queues from the rabbitmqctl command.
If you are looking to do some simple presence notification / messaging. Here are two links that may be helpful.The first is an extension that adds a new exchange type to rabbit and the second is a blog post with a section on how one may implement presence notifications using exchange to exchange bindings.
https://github.com/tonyg/presence-exchange
http://www.rabbitmq.com/blog/2010/10/19/exchange-to-exchange-bindings/
Upvotes: 4