Open lzyrapx opened 5 years ago
When requeue is true, request the server to deliver this message to a different consumer
. If it is not possible
or requeue is false, the message will be dropped
or delivered to a server configured dead-letter queue.
refer to https://godoc.org/github.com/streadway/amqp#Delivery.Nack
@LzyRapx A popular strategy is to pull out the message from a Channel with Confirm enabled, so you can perform Acks/Nacks like you have sample code for. Then you try to perform some operation against the message - handle when things did not go as planned by publishing the message to an alternative queue. Once successfully published to other queue, acknowledge message from the original channel. In your case, you would publish to the source Queue (instead of another destination) and it would naturally be at the bottom for replay later.
The way to requeue the message to the beginning of the source queue (republish) is create a queue dead-letter-exchange policy without Exchange Name specification. In this case a rejected message will be republished back to the original Exchange with the original Routing Key. This kind of policy should be established through the broker HTTP API.
Hi, all. I'd like to ask how to return message to the end of queue in rabbitmq?
Example:
The Code below did not work.
Thanks in advance.