简体   繁体   English

RabbitMQ:在收到确认后将消息移到另一个队列

[英]RabbitMQ: Move messages to another queue on acknowledgement received

I have a setup with two queues (no exchanges), let's say queue A and queue B. 我有一个带有两个队列的设置(没有交换),比方说队列A和队列B。

One parser puts messages on queue A, that are consumed by ElasticSearch RabbitMQ river. 一个解析器将消息放入队列A,由ElasticSearch RabbitMQ river使用。

What I want now is to move messages from queue A to queue B when the ES river sends an ack to the queue A, so that I can do other processing in the ack'd messages, being sure that ES already has processed them. 我现在想要的是在ES河将确认发送到队列A时将消息从队列A移到队列B,以便我可以在确认消息中进行其他处理,确保ES已经处理了它们。

Is there any way in RabbitMQ to do this? RabbitMQ有什么办法做到这一点? If not, is there any other setup that can guarantee me that a message is only in queue B after being processed by ES? 如果不是,是否还有其他设置可以保证我仅在ES处理完消息后才将消息放入队列B中?

Thanks in advance 提前致谢

I don't think this is supported by either AMQP or the rabbitmq extensions . 我不认为AMQP或Rabbitmq扩展都支持此功能

  1. You could drop the river and let your consumer also publish to elasticsearch. 您可以顺其自然,让您的消费者也可以发布到elasticsearch。

  2. Since a normal behavior is that the queues are empty you can just perform a few retries of reading the entries from elasticsearch (with exponential backoff), so even if the elasticsearch loses the initial race it will backoff a bit and you can then perform the task. 由于正常的行为是队列为空,您可以执行几次重试以从Elasticsearch中读取条目(具有指数回退),因此即使Elasticsearch失去了初始竞争也将回退一点,然后您可以执行任务。 This might require tuning the prefetch_size/count in your clients. 这可能需要调整客户端中的prefetch_size / count。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM