Is it possible to view RabbitMQ message contents directly from the command line?

Shears picture Shears · May 22, 2012 · Viewed 147k times · Source

Is it possible to view RabbitMQ message contents directly from the command line?

sudo rabbitmqctl list_queues lists the queues.

Is there any command like sudo rabbitmqctl list_queue_messages <queue_name>?

Answer

robthewolf picture robthewolf · May 22, 2012

You should enable the management plugin.

rabbitmq-plugins enable rabbitmq_management

See here:

http://www.rabbitmq.com/plugins.html

And here for the specifics of management.

http://www.rabbitmq.com/management.html

Finally once set up you will need to follow the instructions below to install and use the rabbitmqadmin tool. Which can be used to fully interact with the system. http://www.rabbitmq.com/management-cli.html

For example:

rabbitmqadmin get queue=<QueueName> requeue=false

will give you the first message off the queue.