Hello Luke,
Thank you for your message. I will try to explain my problem in a much more clear way. So the consumer code is below:
import pika
import numpy as np
import time
import json
import base64
import threading
def on_reply(ch, method, properties, body):
print(body)
host = 'localhost'
# rabbitmq for task queueing
parameters = pika.ConnectionParameters(host=host, port=5672, heartbeat=0)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
print('Connection Successful')
# create/check the task queue
task_queue = channel.queue_declare(queue="task-queue", arguments={'x-consumer-timeout' : 60000})
channel.basic_qos(prefetch_count=1)
# auto_ack is handled manually
channel.basic_consume(queue='task-queue',
auto_ack=False,
on_message_callback=on_reply
)
channel.start_consuming()
Also, find the screenshot attached. If I abrupt the above python script when it is consuming, the consumer still remains in the task-queue and as soon as I run the script again a second instance of the consumer is created.
Also, I changed the consumer timeout to 1 Minute, even then after 1 minute the consumer which had died, doesn't get removed automatically, is my understanding of consumer timeout correct ?
Related to the requeuing of the messages, the messages which are unacked doesnt get requeue even for the new consumer instance that is created.
I hope the explanation helps you in finding out what is going wrong.
Thanks,
Dhruv