I got a situation where a message remained unacknowledged in a RabbitMQ queue. I wanted the related consumer to stop and remove the message from the queue.
Let me walk you through the steps to get this done.
Through the Management Portal
In this post I’ll show you how to this through the Management Portal, in a later post I’ll show you how to do this from the commandline.
- Open the RabbitMQ Management Portal. Go to the Queues tab. Notice that in one of my queues I have an ‘Unacked’ message.
- First we need to find the connection that is related to the application consuming the message. Therefore go to the Connections tab.
- Click on the correct connection. Expand the Close this connection section and hit the Force Close button to close the connection and related channels. Click OK when asked for confirmation.
- Now go back to the Queues tab. Click on the queue with the ‘Unacked’ message. Expand the Purge section and hit the Purge Messages button.
- If you try to do the Purge Messages without closing the connection first, the message will reappear.
- The unacked message should be gone.