[rabbitmq-discuss] Identifying and deleting messages from RMQ queues

Emile Joubert emile at rabbitmq.com
Wed Oct 9 14:50:06 BST 2013


On 09/10/13 14:34, ding wrote:

> In other word, I want to delete cancelled messages from RMQ queues so
> that consumer don't receive them.

No, you can only remove messages from the front of the queue. If the
message that you want to delete has not reached the front yet then you
must wait for it to reach the front before it can be deleted.

You may be able to send deletion messages to a separate deletion queue,
and have the consumer subscribe to the deletion queue as well. If the
consumer receives a deletion message then it will know to ignore the
corresponding message when it reaches the front of the regular
processing queue.
The deletion queue will need to stay short and the consumer will have to
prioritise message from the deletion queue.
This will only work if there is one consumer. If there are multiple
consumers then they will need to arrange to share the information from
the deletion queue.
This solution is also inherently racy. The broker does not guarantee the
relative order of messages that travel by different paths.


More information about the rabbitmq-discuss mailing list