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
following the answer of ChillarAnand you can get the value easily. the data is in the object.
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost',
port=5672,
credentials=pika.credentials.PlainCredentials('guest', 'guest'),
)
channel = connection.channel()
print(channel.queue_declare(queue="your_queue", durable=True, exclusive=False,
auto_delete=False).method.message_count)
and you will get the exact message number