How to selectively delete messages from the AMQP queue (RabbitMQ)?

I want to selectively delete messages from the AMQP queue without even reading them.

The scenario is as follows:

The sender wants to expire messages of type X based on the fact that new information of type X has appeared. Since it is very likely that the subscriber has not yet consumed the last message of type X, the publisher should simply delete the previous messages of type X and place the latter in the queue. The whole operation should be transparent to the subscriber - in fact, he should use something as simple as STOMP to receive messages.

How to do it using AMQP? Or maybe it is more convenient in another messaging protocol?

I would like to avoid complex infrastructure. All the necessary messaging is as simple as above: one queue, one subscriber, one publisher, but the publisher should be able to delete messages for specified criteria ad-hoc.

The publisher client will use Ruby, but in fact I would deal with any language as soon as I know how to do this in the protocol.

+2
source share
4 answers

Currently, you cannot do this in RabbitMQ (or, more broadly, in AMQP) automatically. But, here is an easy workaround.

, : Xs, Ys Zs. , X, , X-, .

RabbitMQ:

  • : X, Y Z ( , ),
  • (, X, X); ,
  • (X X-, Y Y ..); , basic.get, .

, . , ( ) , , , .

, , : X X.

, rabbitmq-discuss.

+4

, . , Redis Tokyo Tyrant . memcache.

. , , .

, , . . , , .

, , - key: typecode value: lastUpdated, important data

, typecode, lastUpdated , lastupdated , , , .

AMQP, RabbitMQ , Exchange Cache Exchange. https://github.com/squaremo/rabbitmq-lvc-plugin

+6

. . , ( FIFO) , rabbitmqadmin :

rabbitmqadmin get queue=queuename requeue=false count=1

. (-) , . .

sudo python rabbitmqadmin -V virtualhostname -u user -p pass get queue=queuename requeue=false count=1 payload_file=~/origmsg

+1

, - RabbitMQ, n

  • "", " "
  • "Requeue = No" ,
  • " ".
0

All Articles