We have a backup queue in RabbitMQ that simply keeps a copy of old messages for human consumption. There are no consumers on this queue, and the only way to view messages is to use the Get Messages UI/API.
The issue is that one of the users tried to Get over 24k messages with requeue enabled, and the queue got into a bad state.
Currently I see that there are 24k unacked messages, but I don't have any consumers on the queue.
All I want to do at this point is purge the queue to get rid of the old messages, but I cannot clear the ones that are unacked. And since there are no consumers, I am not aware of any connection that I can close which would move the messages back into ready status.
Is there any Admin action I can do to empty out the contents of this queue? If not, is there anything I can do at this point to move the message back into ready status?
Edit: Other similar questions on this topic all have consumers whereas I do not, so their solutions don't apply to me. Hence why I am creating this as a new question.
Thank you
RabbitMQ Screenshot of Unacked Messages
Is there any Admin action I can do to empty out the contents of this queue?
Yes. Simply delete and re-declare the queue. There should be a button in the management console that does this for you, then you'd have to re-declare it manually as well as re-bind it to the exchange. If you're worried about losing other messages, you can declare a new queue with a different name before deleting the old one.
And since there are no consumers, I am not aware of any connection that I can close which would move the messages back into ready status.
This is a tough one. The management command to get messages is supposed to immediately "nack" the message to put it back in the queue (depending on settings). This is probably a bug, but the use-case that you describe (just having a queue that accumulates messages with no consumer) is not really a valid use case, so even if it is a bug, it may not be a huge priority for someone to work.
Note that unacked messages are tied to a particular channel and not a specific consumer (I assume, but do not know for a fact, that the management API works by creating a channel under the hood). So it also might be possible to requeue these by shutting down and restarting the management plug-in, or even possibly the broker (though all bets are off there).
From this post, the following should restart the management plugin:
rabbitmqctl eval 'application:stop(rabbitmq_management).'
rabbitmqctl eval 'application:start(rabbitmq_management).'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With