Basic nack provides facility to return negative acknowledgement for one or multiple messages.
Basic reject has facility to return negative acknowledgement for only one message.
Do we have any use case where we definitely need basic reject?
The answer by @cantSleepNow is correct, I would also like to add one more difference which is in their default behaviour.
By default, nack will put the message back in the queue for later handling. You can change the setting to not re-queue with nack.
With reject, by default, the message is not re-queued by RabbitMQ but will drop the message from the queue entirely.
With rabbitmq you can always nack over reject. Logically there is no explicit need to use reject, since nack can do anything reject can. As you said, both of these work for one message, but nack also for multiple.
Also nack is introduced by rabbitmq (so it's an extension), and is not part of amqp 0.9.1 specs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With