RabbitMQ Interview Problems
RabbitMQ Interview Problems
What messaging patterns does RabbitMQ support and how are they
implemented?
RabbitMQ supports several messaging patterns:
Point-to-Point — one producer, one consumer (via queues).
Publish/Subscribe — fanout exchange sends message to all bound queues.
Routing — direct exchange routes messages based on exact routing keys.
Topic — topic exchange uses pattern matching for routing keys.
RPC — reply queues and correlation IDs for request-response semantics.
Implemented using exchanges, queues, bindings, and routing keys.
What are the different exchange types in RabbitMQ and when would you use
each?
Direct Exchange:
Routes messages to queues with exact matching routing keys.
Use for one-to-one or targeted routing.
Fanout Exchange:
Routes to all bound queues — ignores routing key.
Use for broadcasting notifications.
Topic Exchange:
Supports pattern matching (e.g., user.*.update).
Use for complex routing scenarios and flexible consumers.
Headers Exchange:
Routes based on message header attributes, not routing key.
Use when routing logic depends on message metadata.
What are common RabbitMQ monitoring metrics and what do they indicate?
Key metrics to monitor:
Ready messages — messages available for delivery.
Unacknowledged messages — in-flight messages, may indicate slow consumers.
Queue depth — backlog of messages, indicates load issues.
Connections and channels — too many can signal resource leaks.
Memory and disk usage — high usage can block publishing.
Use RabbitMQ Management UI or Prometheus exporters for monitoring and alerting.