[rabbitmq-discuss] Recommended ways of basic queue introspection
emile at rabbitmq.com
Mon Aug 1 14:03:56 BST 2011
On 01/08/11 13:19, Michael Klishin wrote:
> I have a need of introspecting some queues (very basic form of querying:
> list all messages in the queue) and draining with basic.get + requeuing
> is not an option
> for various reasons. Number of messages at any given time will always be
> low (< 100).
> Does RabbitMQ HTTP management API offer anything like this? If I am
> willing to put together a small extension that will query Mnesia, are
> there any caveats
> or extension points or something I should be aware of? Finally, would it
> make sense to try to extend HTTP API of the management plugin and
> contribute back to it?
The feature you are asking for is "queue browsing". RabbitMQ queues are
strictly FIFO, precluding queue browsing. If you don't care about
message order then you could attempt to emulate browsing by fetching and
requeueing messages, but you say that is not possible in your case.
The other possibility is to provide your own browsable queue
implementation. This is not a trivial undertaking, but it is possible to
slot in your own implementation and make it free from FIFO restrictions.
The HTTP management API does not have privileged access to queue
contents. You can fetch and requeue messages, but not in a way that
ignores the FIFO property of queues.
Queue contents are not stored in Mnesia, but in an optimised persistent
format. But knowing that is not much help because transient messages are
not guaranteed to be on disk. If you are only interested in browsing
persistent messages then you could use a database message store and
browse that. See http://hg.rabbitmq.com/rabbitmq-toke for a possible
More information about the rabbitmq-discuss