Skip to main content
InterviewHubPRO
Section Overview
Q21

Question 21 of 50

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

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

What is the Alternate Exchange (`alternate-exchange`)?

senior LevelCode ExampleSystem Design

In Simple Words: If a producer publishes a message to an exchange with a routing key that does not match any queue bindings:

  • By default, RabbitMQ silently discards the message!
  • To prevent silent drops, attach an Alternate Exchange:
    bash
    rabbitmqctl set_policy AE "^orders_exchange$" \
      '{"alternate-exchange": "unrouted_messages_exchange"}' --apply-to exchanges
    
    Any unroutable messages sent to orders_exchange are automatically forwarded to unrouted_messages_exchange for logging and auditing.