0% found this document useful (0 votes)
18 views2 pages

RabbitMQ Interview Problems

RabbitMQ supports various messaging patterns including Point-to-Point, Publish/Subscribe, Routing, Topic, and RPC, implemented through exchanges, queues, bindings, and routing keys. Reliable message delivery can be ensured using durable queues, persistent messages, publisher confirms, consumer acknowledgments, and retry logic with Dead Letter Queues. Different exchange types like Direct, Fanout, Topic, and Headers serve specific routing needs, while horizontal scaling of consumers can be achieved through competing consumers and manual acknowledgments to prevent message loss or duplication.

Uploaded by

pbecic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

RabbitMQ Interview Problems

RabbitMQ supports various messaging patterns including Point-to-Point, Publish/Subscribe, Routing, Topic, and RPC, implemented through exchanges, queues, bindings, and routing keys. Reliable message delivery can be ensured using durable queues, persistent messages, publisher confirms, consumer acknowledgments, and retry logic with Dead Letter Queues. Different exchange types like Direct, Fanout, Topic, and Headers serve specific routing needs, while horizontal scaling of consumers can be achieved through competing consumers and manual acknowledgments to prevent message loss or duplication.

Uploaded by

pbecic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

RabbitMQ for Strong Senior Developers

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.

How would you ensure reliable delivery of messages in RabbitMQ?


 Reliable delivery techniques:
 Use durable queues and persistent messages (delivery_mode=2).
 Enable publisher confirms (confirms that message reached broker).
 Use consumer acknowledgments (manual or auto-ack=false).
 Implement retry logic and DLQs (Dead Letter Queues) for failures.
 Ensure network stability and tune prefetch count to control message flow.

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.

How would you scale RabbitMQ consumers horizontally while avoiding


message duplication or loss?
 Techniques for safe horizontal scaling:
 Use competing consumers — multiple consumers on same queue share load.
 Enable manual acknowledgments to ensure message is not lost until processed.
 Avoid automatic requeueing of failed messages (use DLQs instead).
 Ensure idempotent processing to tolerate retries and duplicates.
 Monitor queue depth, processing rate, and unacknowledged messages.

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.

You might also like