RabbitMQ basic recovery not working

We have a solid line of RabbitMQ. When a consumer receives an item from the queue, it processes it and then confirms it. If the consumer does not process the item, it prints an error, expecting someone to fix the problem and stop. No confirmation is sent. When the consumer restarts the item that he receives, this is the next item in the queue, not the unsigned item. Basic.Recover () does not help (using the .NET client). Any ideas on how to make it work as a queue always get the first element if it is not disabled.

+3
source share
4 answers

See this entry in the RabbitMQ FAQ . Although you might want RabbitMQ to run your loose messages right back in the queue head (where they were before your consumer pulled them), the reality will probably be different, as you already experienced.

So this is not something that Basic.Recover()does not work (the message has been queued for further processing) just so that it does not work as you expected.

- , , 1 , , . . , , , , / , , .

+3

: noAck = false noAck = true

noAck - Model.BasicConsume, Model.BasicGet

noAck , . noAsk false, basicAck.

noAck = false, basicAck, , , ( , ). BasicReject, .

, .

+2

RabbitMQ, , 2.7.0, . , , , .

+1

You can get this behavior with a couple of queues, one high priority and one normal priority. Set the prefetch counter to 1, and then alternate the queues between them using basic.get. In most cases, the priority queue will be empty, but when you want to request, post the message again to the high priority queue.

This works in a scenario where you have several processes consuming a message flow, and one process decides to help out the message. This message will be received almost immediately by another process.

0
source

All Articles