Skip to main content
InterviewHubPRO
Section Overview
Q14

Question 14 of 50

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

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

What are Dead Letter Exchanges (DLX) and Dead Letter Queues (DLQ)?

senior LevelCode ExampleSystem DesignRabbitMQData Structures

In Simple Words: A Dead Letter Exchange (DLX) is a standard exchange configured to receive messages that cannot be processed. A message is "dead-lettered" when:

  1. It is rejected (basic.reject or basic.nack) with requeue=false.
  2. The message expires due to Time-To-Live (TTL).
  3. The queue reaches its maximum length limit (x-max-length).

Configuration:

javascript
// Declare the main queue with DLX arguments
await channel.assertQueue('orders_queue', {
  durable: true,
  arguments: {
    'x-dead-letter-exchange': 'orders_dlx',
    'x-dead-letter-routing-key': 'orders.dead'
  }
});