Skip to main content
InterviewHubPRO
Section Overview
Q15

Question 15 of 50

Part 2: Core Architecture & Implementation (Mid-Level)

30%
RabbitMQ & AMQP (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)

How do you implement Delayed / Scheduled Retries using TTL and DLX?

senior LevelCode ExampleSystem DesignRabbitMQData Structures

In Simple Words: RabbitMQ does not natively have a "sleep 60 seconds" feature, but you can build one cleanly using Queue TTL + DLX:

scss
[ Producer ] ---> [ Retry Queue (TTL: 60s, NO Consumers) ]
                         |
                         | (60s timer expires)
                         v
                  [ Dead Letter Exchange ] ---> [ Main Processing Queue ] ---> [ Consumer ]
  1. When a task fails, reject it with requeue=false.
  2. Route it to a retry_wait_60s queue configured with x-message-ttl: 60000 and x-dead-letter-exchange: main_exchange.
  3. The message sits in the wait queue for 60 seconds with no consumers.
  4. When TTL expires, RabbitMQ dead-letters it back to main_exchange, delivering it back to the worker for a retry.