I'm trying to understand how to set the redelivery time for basic.nacked messages. Some important info is that I'm using quorum queues with a redelivery amount of 5 times. Consider the following scenario:
What is happening Now:
What I actually want:
I want the message that is requeued to wait a few seconds (3-5 sec or something) before it's once again handled by a consumer. I want to do this due to the fact that I'm using OCC & there are instances where delaying the message redelivery solves consistency issues. (for the people wondering why in god's name I need this).
I was able to do this with NATS streaming server, but I don't know how to implement it with rabbitMQ.
Additional info: I'm using amqplib (typescript) as the client and prefetch is set to 10 globally. I'm using AWS MQ for Rabbit as my rabbitMQ host
As far as i know, there isn't a way to add RabbitMQ Delayed Message Plugin to AWS MQ. You can:
dead_letter_queue
with x-message-ttl
option, with value you need (3-5 secs)dead_letter_queue
dead letter exchange will be your original exchangedead_letter_exchange
connected with dead_letter_queue
Workflow:
nack
messagedead_letter_exchange
dead_letter_exchange
it goes to dead_letter_queue
dead_letter_queue
message waits x-message-ttl
time