Expired messages are not deleted from RabbitMQ

I send a normal message through the manufacturer to RabbitMQ, and then send a second message with the expiration attribute assigned to the value. Then, using the rabbitmqctl list_queues , I track the status of the messages.

I found that if you first send a standard message, and then a message with expiration , then rabbitmqctl list_queues always shows me 2 messages waiting for a queue. When I use them, I get only one.

On the other hand, if I send only 1 message with expiration , at the beginning I see the message, and then after the correct expiration time, I find it deleted.

My question is that in the first situation the message actually takes up space? Or is it an interface error?

My version of rabbitMQ: rabbitmq-server.noarch -> 3.1.5-1.el6

+5
source share
1 answer

It looks like you missed some of the documentation for this feature. If you read the RabbitMQ documentation for each TTL message (expiration) , you will see the following warning about what behavior you see (highlighted added):

Warnings

While consumers never see expired messages, only when expiring messages reach the head of the queue, they will actually be discarded (or dead letters). When configuring TTL for each queue, this is not a problem, since expired messages are always at the head of the queue. When setting TTL to a message, however, expired messages can queue for unexpired messages until they expire or are consumed. Consequently, the resources used by such expired messages will not be released, and they will be counted in the queue statistics (for example, the number of messages in the queue).

+12
source

Source: https://habr.com/ru/post/1211285/


All Articles