How to remove an inactive consumer from rabbitmq queue?

27 views Asked by At

I have a simple setup where a message is sent to a queue via an exchange and the consumer binds to it and receives the message for further processing.

The problem is whenever I forcefully stop the consumer script and re-start it, a new consumer is created in the queue, but the previous one is still active in the queue.

Now, when my producer script sends a message to the queue, it is "unacked" by the previous consumer instance (which is still active in the queue) and after the redelivery time of 30 seconds it goes to the current(actually active) consumer and then it is acknowledged.

Q1:

How can I reduce the re-delivery time of the messages which are unacked ?

Q2:

How can the consumer that goes inactive gets removed automatically from the queue ?

Any other inputs would be helpful.

Thanks.

0

There are 0 answers