Skip to content

Instantly share code, notes, and snippets.

@bthelen
Created April 12, 2018 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bthelen/11ad4483d0c567ad597f8713641169d4 to your computer and use it in GitHub Desktop.
Save bthelen/11ad4483d0c567ad597f8713641169d4 to your computer and use it in GitHub Desktop.
Example steps to show how to view RabbitMQ messages without totally removing them
#Run RabbitMQ
docker run -d --hostname my-rabbit -p 15672:15672 rabbitmq:3-management
#Make a queue called foo
curl -s -u guest:guest -H "content-type:application/json" -X PUT http://127.0.0.1:15672/api/queues/%2F/foo
#Put some messages
curl -u guest:guest -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2f/amq.default/publish -d'{"properties":{"delivery_mode":2},"routing_key":"foo","payload":"aaaaaa","payload_encoding":"string"}'
curl -u guest:guest -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2f/amq.default/publish -d'{"properties":{"delivery_mode":2},"routing_key":"foo","payload":"bbbbbb","payload_encoding":"string"}'
curl -u guest:guest -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2f/amq.default/publish -d'{"properties":{"delivery_mode":2},"routing_key":"foo","payload":"cccccc","payload_encoding":"string"}'
curl -u guest:guest -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2f/amq.default/publish -d'{"properties":{"delivery_mode":2},"routing_key":"foo","payload":"dddddd","payload_encoding":"string"}'
curl -u guest:guest -H "content-type:application/json" -X POST http://localhost:15672/api/exchanges/%2f/amq.default/publish -d'{"properties":{"delivery_mode":2},"routing_key":"foo","payload":"eeeeee","payload_encoding":"string"}'
#Retrieve messages
curl -s -u guest:guest -H "content-type:application/json" -X POST http://127.0.0.1:15672/api/queues/%2F/foo/get -d'{"count":5,"requeue":true,"encoding":"auto","truncate":50000, "ackmode": "ack_requeue_true"}' | jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment