ansatgol
ansatgol

Reputation: 185

How to remove specific message from queue in rabbitmq

I use rabbitmq. I created a queue and put 10 messages here.

I want to delete only specific one of 10 messages here. Is there a way to delete it?

Upvotes: 9

Views: 12439

Answers (2)

mPrinC
mPrinC

Reputation: 9401

The rabbitmq API doesn't seem to support deleting a separate message, but only purging all of them: sudo rabbitmqctl purge_queue <queue name>

However, you can use tricks as written here How to delete a specific message from RabbitMQ Queue? and here is his package rabbitmq-delete-message if you are comfortable with node.js

Upvotes: 0

Andreas
Andreas

Reputation: 2521

No, there is no way to do that directly. Some alternatives are:

  1. Purge the queue and add back the 9 other messages
  2. Check for that one message on the consumer side and reject/ignore that message
  3. Forward all the messages to another queue, except for that 1 message

Upvotes: 6

Related Questions