RabbitMQ Queue Expires While in Use

993 Views Asked by At

I have created RabbitMQ queues with x-expires policies using EasyNetQ (ISubscriptionConfiguration.WithExpires). I am experiencing situations where queues that have consumers expire and get deleted, unexpectedly ending my subscription to the queue.

The official RabbitMQ docs on Queue TTL specify that

Queues will expire after a period of time only when they are not used (e.g. do not have consumers).

It also defines "unused" as meaning

the queue has no consumers, the queue has not been recently redeclared (redeclaring renews the lease), and basic.get has not been invoked for a duration of at least the expiration period.

Based on this, I would expect that a queue would only expire if it has no consumers. Meaning that, even if a queue has not gotten a message for the duration of the expiration period, a consumer of the queue would prevent it from expiring.

Is my interpretation of the docs incorrect? Why would my queues expire if they have a consumer?

1

There are 1 best solutions below

0
On

Remove auto-delete from your policies or queue declarations.

Auto-delete will immediately delete the queue when all consumers are disconnected, so it's basically an x-expires=0 (immediately after disconnect).