명령 줄에서 직접 RabbitMQ 메시지 내용을 볼 수 있습니까?
명령 줄에서 직접 RabbitMQ 메시지 내용을 볼 수 있습니까?
sudo rabbitmqctl list_queues
대기열을 나열합니다.
다음과 같은 명령 명령이 sudo rabbitmqctl list_queue_messages queue_name
있습니까?
관리 플러그인을 활성화해야합니다.
rabbitmq-plugins enable rabbitmq_management
여기를 보아라:
http://www.rabbitmq.com/plugins.html
그리고 여기에 관리의 세부 사항이 있습니다.
http://www.rabbitmq.com/management.html
마지막으로 설정이 완료되면 아래 지침에 따라 rabbitmqadmin 도구를 설치하고 사용해야합니다. 시스템과 완전히 상호 작용하는 데 사용할 수 있습니다. http://www.rabbitmq.com/management-cli.html
예를 들면 :
rabbitmqadmin get queue=<QueueName> requeue=false
대기열에서 첫 번째 메시지를 제공합니다.
큐의 내용을 가져 오는 데 사용하는 명령은 다음과 같습니다.
https://www.rabbitmq.com/management-cli.html을 사용하는 Fedora linux의 RabbitMQ 버전 3.1.5
내 교환은 다음과 같습니다.
eric@dev ~ $ sudo python rabbitmqadmin list exchanges
+-------+--------------------+---------+-------------+---------+----------+
| vhost | name | type | auto_delete | durable | internal |
+-------+--------------------+---------+-------------+---------+----------+
| / | | direct | False | True | False |
| / | kowalski | topic | False | True | False |
+-------+--------------------+---------+-------------+---------+----------+
내 대기열은 다음과 같습니다.
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 |
+-------+----------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+---------------------+--------+---------+
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는 대기열에서 메시지를 봅니다.
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 |
+-------------+----------+---------------+---------------------------------------+---------------+------------------+------------+-------------+
RabbitMQ 큐에서 로컬 파일로 메시지를 덤프하고 메시지를 원래 순서대로 다시 큐에 넣을 수있는 rabbitmq-dump-queue 를 작성 했습니다 .
사용 예 (queue의 처음 50 개 메시지 덤프 incoming_1
) :
rabbitmq-dump-queue -url="amqp://user:password@rabbitmq.example.com:5672/" -queue=incoming_1 -max-messages=50 -output-dir=/tmp
RabbitMQ API를 사용하여 개수 또는 메시지를 가져올 수 있습니다.
/api/queues/vhost/name/get
대기열에서 메시지를 가져옵니다. (이것은 큐의 상태를 변경하므로 HTTP GET이 아닙니다.) 다음과 같은 본문을 게시해야합니다.
{"count":5,"requeue":true,"encoding":"auto","truncate":50000}
count는 가져올 최대 메시지 수를 제어합니다. 큐에서 즉시 제공 할 수없는 경우 이보다 적은 메시지를받을 수 있습니다.
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
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
'IT story' 카테고리의 다른 글
UNIX mailx 명령을 통해 어떻게 이메일을 보낼 수 있습니까? (0) | 2020.09.09 |
---|---|
Razor 구문은 UI 마크 업에서 강력한 이점을 제공합니까? (0) | 2020.09.09 |
PrevTask.Wait ()를 ContinueWith와 함께 사용하는 것이 좋습니다 (태스크 라이브러리에서)? (0) | 2020.09.09 |
Android Studio / IntelliJ에서 Maven 종속성을 가져 오는 방법은 무엇입니까? (0) | 2020.09.09 |
SQL 업데이트 쿼리의 집계 함수? (0) | 2020.09.09 |