I'm trying to use pika to get the number of items in my RabbitMQ queue. I have the following running:
params = pika.ConnectionParameters(host='my.host.com', port=5672, credentials=pika.credentials.PlainCredentials('myuser', 'myauth'))
connection = pika.BlockingConnection(parameters=params)
channel = connection.channel()
response = channel.queue_declare(passive=True, queue='my-queue-name')
count = response.method.message_count
channel.close()
print response
When I run this, count is always 0 regardless of how many items are in the queue. I can see items present with rabbitmqctl but my script won't show them. What am I doing wrong here?