[rabbitmq-discuss] Auto delete messages in Queue after queue size reaches a certain number

Matthias Radestock matthias at rabbitmq.com
Thu Jul 5 09:34:45 BST 2012


On 05/07/12 09:06, alvinRMQ wrote:
> Is there a way for the rabbitMQ broker to automatically throw away messages
> in a Queue if the number of messages is above a certain number?

The closest RabbitMQ has to that is per-queue message ttl. See 
http://www.rabbitmq.com/extensions.html#queue-ttl. That is based on time 
rather than a count, which is arguably more useful - i.e. one can 
imagine that an app may not care about messages older than n seconds, 
whereas it is hard to conceive of an app that doesn't care about 
messages thrown away from the front (or back?) of the queue based on a 
count.

> It is possible that a consumer may not be able to keep up with the
> publisher, and cause the Rabbit Broker to slowly run out of disk space.

...at which point rabbit will block the producers until the consumers 
have drained enough messages to clear the disk alarm.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list