3

I have a k8s service, using rabbitMQ as message broker. I want to be able to delete a specific queue if the service deployment which may have multiple pods is stopped.

Reading the documentation RabbitMq Queues Docs I found that the best case for me in this case is to use the auto-deleted property of the queue.

Is there any option so the auto-deleted queue will not be deleted immediately after the clients are disconnected, instead to wait some seconds to wait for reconnection ?

1 Answer 1

0

Set expires policy on queues as per https://www.rabbitmq.com/ttl.html#queue-ttl.

rabbitmqctl set_policy ZeroConsumerQueExpiry "myProjectQueue.*" '{"expires":10000}' --apply-to queues

It will support your use case in following ways

  1. waits for reconnection for 10 seconds
  2. Auto Deletes Queue if no consumer connects or reconnects for 10 seconds

There will be a difference in using auto-delete vs expires policy

  1. Auto-delete will not delete an inactive queue unless a consumer connects to it
  2. expires policy will will delete the queue whether a consumer has ever connected or never connected. Only catch is that within if there is no activity for given milliseconds, the queue gets deleted.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.