py-amqplib

Getting number of messages in a RabbitMQ queue

空扰寡人 提交于 2019-11-27 23:33:00
We're using amqplib to publish/consume messages. I want to be able to read the number of messages on a queue (ideally both acknowledged and unacknowledged). This will allow me to show a nice status diagram to the admin users and detect if a certain component is not keeping up with the load. I can't find any information in the amqplib docs about reading queue status. Can someone point me in the right direction? Using pika: import pika pika_conn_params = pika.ConnectionParameters( host='localhost', port=5672, credentials=pika.credentials.PlainCredentials('guest', 'guest'), ) connection = pika

Wait for a single RabbitMQ message with a timeout

时光总嘲笑我的痴心妄想 提交于 2019-11-27 21:25:11
问题 I'd like to send a message to a RabbitMQ server and then wait for a reply message (on a "reply-to" queue). Of course, I don't want to wait forever in case the application processing these messages is down - there needs to be a timeout. It sounds like a very basic task, yet I can't find a way to do this. I've now run into this problem with both py-amqplib and the RabbitMQ .NET client. The best solution I've got so far is to poll using basic_get with sleep in-between, but this is pretty ugly:

Getting number of messages in a RabbitMQ queue

被刻印的时光 ゝ 提交于 2019-11-26 21:30:22
问题 We're using amqplib to publish/consume messages. I want to be able to read the number of messages on a queue (ideally both acknowledged and unacknowledged). This will allow me to show a nice status diagram to the admin users and detect if a certain component is not keeping up with the load. I can't find any information in the amqplib docs about reading queue status. Can someone point me in the right direction? 回答1: Using pika: import pika pika_conn_params = pika.ConnectionParameters( host=