Is there a way to get the size (remaining messages) of a queue in rabbitmq with a simple Curl?
Something like curl -xget http://host:1234/api/queue/test/stats
Thank you
The API documentation is installed along with the RabbitMQ management console and should be available on that server at http://MY_RABBITMQ_SERVER:15672/api . Show activity on this post. I was able to get the size/depth of queue from python program.
Define Max Queue Length Using a Policy When the 1MiB limit is reached, the oldest messages are discarded from the head of the queue.
In php-amqlib: $channel->basic_get(QUEUE_NAME, true); // the second arg is no_ack . The second argument marks that no acknowledgment is expected for that message. That is, you don't have to "flag" the message as read for RabbitMQ to confidently dequeue it.
Queues are single-threaded in RabbitMQ, and one queue can handle up to about 50 thousand messages.
Finally I did the trick with the following:
curl -s -i -u guest:guest http://host:port/api/queues/vhost/queue_name | sed 's/,/\n/g' | grep '"messages"' | sed 's/"messages"://g'
As much as I love hacky sed one-liners this is probably the cleanest solution:
curl -s -u <user>:<password> http://<host>:<port>/api/queues/<virtual-host>/<queue> | jq .messages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With