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

rabbitmq management view messages
rabbitmq get message from queue
rabbitmq web interface
install rabbitmqctl
rabbitmq api
rabbitmqctl set_permissions
rabbitmq check queue size
rabbitmqadmin windows

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

sudo rabbitmqctl list_queues lists the queues.

Is there any command command like sudo rabbitmqctl list_queue_messages queue_name?


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.

Management Command Line Tool — RabbitMQ, The management plugin ships with a command line tool rabbitmqadmin which can perform exchanges, queues, bindings, vhosts, users and permissions; publish and get messages For other tasks, see rabbitmqctl and rabbitmq- plugins. If you have questions about the contents of this guide or any other topic related to� Sometimes you want to visually see if a message has been sent. Wouldn't it be nice if you had the possibility to peek inside queues and query them for message contents? Find out how to do that via


Here are the commands I use to get the contents of the queue:

RabbitMQ version 3.1.5 on Fedora linux using https://www.rabbitmq.com/management-cli.html

Here are my exchanges:

eric@dev ~ $ sudo python rabbitmqadmin list exchanges
+-------+--------------------+---------+-------------+---------+----------+
| vhost |        name        |  type   | auto_delete | durable | internal |
+-------+--------------------+---------+-------------+---------+----------+
| /     |                    | direct  | False       | True    | False    |
| /     | kowalski           | topic   | False       | True    | False    |
+-------+--------------------+---------+-------------+---------+----------+

Here is my queue:

eric@dev ~ $ sudo python rabbitmqadmin list queues
+-------+----------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| vhost |   name   | auto_delete | consumers | durable | exclusive_consumer_tag |     idle_since      | memory | messages | messages_ready | messages_unacknowledged |        node         | policy | status  |
+-------+----------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
| /     | myqueue  | False       | 0         | True    |                        | 2014-09-10 13:32:18 | 13760  | 0        | 0              | 0                       |rabbit@ip-11-1-52-125|        | running |
+-------+----------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+

Cram some items into myqueue:

curl -i -u guest:guest http://localhost:15672/api/exchanges/%2f/kowalski/publish -d '{"properties":{},"routing_key":"abcxyz","payload":"foobar","payload_encoding":"string"}'
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Date: Wed, 10 Sep 2014 17:46:59 GMT
content-type: application/json
Content-Length: 15
Cache-Control: no-cache

{"routed":true}

RabbitMQ see messages in queue:

eric@dev ~ $ sudo python rabbitmqadmin get queue=myqueue requeue=true count=10
+-------------+----------+---------------+---------------------------------------+---------------+------------------+------------+-------------+
| routing_key | exchange | message_count |                        payload        | payload_bytes | payload_encoding | properties | redelivered |
+-------------+----------+---------------+---------------------------------------+---------------+------------------+------------+-------------+
| abcxyz      | kowalski | 10            | foobar                                | 6             | string           |            | True        |
| abcxyz      | kowalski | 9             | {'testdata':'test'}                   | 19            | string           |            | True        |
| abcxyz      | kowalski | 8             | {'mykey':'myvalue'}                   | 19            | string           |            | True        |
| abcxyz      | kowalski | 7             | {'mykey':'myvalue'}                   | 19            | string           |            | True        |
+-------------+----------+---------------+---------------------------------------+---------------+------------------+------------+-------------+

Monitoring — RabbitMQ, For example, whether RabbitMQ's Erlang VM is running is one such check. The metric in The normal operating parameters are "the process must be running". Finally RabbitMQ CLI tools provide commands that can serve as useful health checks. Number of messages ready for delivery, queue_totals. messages_ready. rabbitmqctl, rabbitmq-diagnostics, rabbitmq-plugins, and rabbitmq-queues support command aliases. How CLI Tools Authenticate to Nodes (and Nodes to Each Other): the Erlang Cookie RabbitMQ nodes and CLI tools (with the exception of rabbitmqadmin ) use a cookie to determine whether they are allowed to communicate with each other.


I wrote rabbitmq-dump-queue which allows dumping messages from a RabbitMQ queue to local files and requeuing the messages in their original order.

Example usage (to dump the first 50 messages of queue incoming_1):

rabbitmq-dump-queue -url="amqp://user:password@rabbitmq.example.com:5672/" -queue=incoming_1 -max-messages=50 -output-dir=/tmp

rabbitmqctl(8) — RabbitMQ, RabbitMQ is an open source multi-protocol messaging broker. To learn more, see the RabbitMQ CLI Tools guide and RabbitMQ Networking guide Therefore you should use this command on the latest node to shut down if at all possible. RAM nodes replicate data in RAM only (with the exception of queue contents,� rabbitmqctl, the provided command line interface doesn't expose the ability to create a queue and bind it. It however is quite trivial to do it w/ a quick script though, and the rabbit mq getting started guide shows several examples of it, both on the publisher as well as the consumer side.


you can use RabbitMQ API to get count or messages :

/api/queues/vhost/name/get

Get messages from a queue. (This is not an HTTP GET as it will alter the state of the queue.) You should post a body looking like:

{"count":5,"requeue":true,"encoding":"auto","truncate":50000}

count controls the maximum number of messages to get. You may get fewer messages than this if the queue cannot immediately provide them.

requeue determines whether the messages will be removed from the queue. If requeue is true they will be requeued - but their redelivered flag will be set. encoding must be either "auto" (in which case the payload will be returned as a string if it is valid UTF-8, and base64 encoded otherwise), or "base64" (in which case the payload will always be base64 encoded). If truncate is present it will truncate the message payload if it is larger than the size given (in bytes). truncate is optional; all other keys are mandatory.

Please note that the publish / get paths in the HTTP API are intended for injecting test messages, diagnostics etc - they do not implement reliable delivery and so should be treated as a sysadmin's tool rather than a general API for messaging.

http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v3_1_3/priv/www/api/index.html

How to look inside RabbitMQ queues for messages (Command Line , Wouldn't it be nice if you had the possibility to peek inside queues and query them for message Duration: 5:05 Posted: Jun 10, 2019 The message with the same payload will be re-queued. As for "peeking" into queues: I had the same problem, I wanted to check out what is flowing through the queues on our brokers. In the end I wrote a few tools to be able to do it from the command line.


a bit late to this, but yes rabbitmq has a build in tracer that allows you to see the incomming messages in a log. When enabled, you can just tail -f /var/tmp/rabbitmq-tracing/.log (on mac) to watch the messages.

the detailed discription is here http://www.mikeobrien.net/blog/tracing-rabbitmq-messages

Is it possible to view RabbitMQ message contents directly , Is it possible to view RabbitMQ message contents directly from the command line ? sudo rabbitmqctl list_queues lists the queues. I need only time spent in RabbitMQ. Network latency will be exclude (customer send a message, RabbitMQ get the message and add the timestamp and I can measure the time in RabbitMQ). Also netowork latency can be measured when the server time (client, RabbitMQ, server app) will be synchronized. – hradilf Jul 20 '17 at 5:51


rabbitmqctl: command line tool for managing a RabbitMQ broker , See rabbitmq-server(1) for details of configuring the RabbitMQ broker. Informational messages are suppressed when quiet mode is in effect. This command instructs the RabbitMQ node to append the contents of the log files to When using the --offline flag rabbitmqctl will not attempt to connect to a node as normal;� See rabbitmq-plugins help and rabbitmq-plugins man page for details. rabbitmq-diagnostics. See rabbitmq-diagnostics help and rabbitmq-diagnostics man page. Testing. See CONTRIBUTING.md. Developing Adding a New Command Conventions. RabbitMQ CLI tools use module name conventions to match the command-line actions (commands) to modules.


RabbitMQ Management HTTP API, Since bindings do not have names or IDs in AMQP we synthesise one based on See the separate stats documentation. A few quick examples for Windows and Unix, using the command line tool X, /api/queues/vhost/name/contents, Contents of a queue. X, /api/queues/vhost/name/get, Get messages from a queue. DESCRIPTION RabbitMQ is an open source multi-protocol messaging broker. rabbitmqctl is a command line tool for managing a RabbitMQ server node. It performs all actions by connecting to the target RabbitMQ node on a dedicated CLI tool communication port and authenticating using a shared secret (known as the cookie file).


rabbitmqctl - command line tool for managing a , See rabbitmq-server(1) for details of configuring the RabbitMQ broker. Informational messages are suppressed when quiet mode is in effect. RAM nodes replicate data in RAM only (with the exception of queue contents, which Therefore you should use this command on the latest node to shut down if at all possible. In RabbitMQ versions starting with 3.7.0 all messages data is combined in the msg_stores/vhosts directory and stored in a subdirectory per vhost. Each vhost directory is named with a hash and contains a .vhost file with the vhost name, so a specific vhost's message set can be backed up separately.