Skip to content
SeeItFlow
Interactive guide · 4 chapters · ~15 min read

RabbitMQ Interview & Revision

Interview questions, revision notes, a self-check quiz, and a cheat sheet — everything to review the night before a systems-design interview.

Mangesh MandlikLast updated:
01 · Interview Prep

Interview Questions

The questions that come up again and again — with the shape of a strong answer, not just the answer itself.

What is RabbitMQ and how does it differ from Kafka?

RabbitMQ is a general-purpose AMQP message broker built for flexible routing and reliable delivery of discrete messages; Kafka is a distributed commit log built for durable, replayable, high-throughput event streaming. Anchor your answer in the workload: task processing vs. event history.

How does RabbitMQ guarantee message delivery?

At-least-once delivery comes from four pieces working together: publisher confirms (producer knows the broker accepted the message), an appropriately durable/replicated queue plus persistent messages (survives broker crash), manual consumer ACK (survives consumer crash), and idempotent handling of duplicates (because redelivery after a crash-before-ACK can still cause double-processing). Explain what breaks if any piece is missing.

Explain the four exchange types.

Direct (exact routing-key match), fanout (broadcast, ignores routing key), topic (wildcard pattern match with * and #), headers (match on message metadata, not routing key). Give a one-line use case for each.

What happens if a consumer crashes without acknowledging a message?

RabbitMQ detects the dropped connection/channel and requeues any unacknowledged messages held by that consumer, making them available for redelivery — typically to a different, healthy consumer.

How do you prevent a poison message from looping forever?

Configure a Dead Letter Exchange (DLX) on the queue, bind a Dead Letter Queue to it, and cap retry attempts — typically via a custom header, checked against the broker-maintained x-death array that records how many times a message has been dead-lettered. After N failures, route to the terminal DLQ instead of retrying again.

What is prefetch count and why does it matter?

Prefetch (QoS) limits how many unacknowledged messages the broker will push to a consumer at once. Lower prefetch means fairer dispatch across consumers; higher prefetch means more buffering and throughput potential but a bigger redelivery blast radius on crash. The right value depends on message processing time and consumer uniformity, not a fixed default.

How does RabbitMQ scale to handle more load?

Distinguish processing scale from availability: adding consumers to a queue is the first lever for parallel processing, but the queue/broker and downstream capacity eventually become the bottleneck, so queue/workload distribution across nodes can matter too. Quorum queues address replicated availability and data safety on node failure — a separate concern from throughput scaling, not simply a capacity mechanism.

02 · Quick Review

Revision Notes

Key takeaways
  1. 01Producers publish to exchanges — including the nameless default exchange, which routes directly to the matching queue name.
  2. 02Exchanges route; queues store. An exchange with no matching binding silently drops the message unless the mandatory flag is set.
  3. 03Direct = exact match. Fanout = broadcast. Topic = wildcard (* one word, # zero+ words). Headers = metadata match.
  4. 04Publisher confirms + durable/replicated queue + persistent message + manual consumer ACK together form the reliable-delivery combo — each protects a different failure point.
  5. 05At-least-once means duplicates are possible; idempotent consumer handling is what makes a redelivered message safe.
  6. 06Unacked messages are requeued automatically if a consumer disconnects, or explicitly via basic.nack/reject with requeue=true.
  7. 07Dead Letter Queues isolate failing messages after a retry limit — configure one where failed work must be inspected or recovered.
  8. 08Prefetch count tunes the throughput/fairness trade-off between consumers; there's no universal default.
  9. 09Adding consumers is the first scaling lever for a queue's processing, but broker/downstream capacity eventually becomes the bottleneck.
  10. 10Quorum queues (Raft-based) are RabbitMQ's replicated queue type; classic mirrored queues were removed in RabbitMQ 4.0.
  11. 11RabbitMQ pushes to consumers; Kafka is pull-based — a key architectural difference.
03 · Self-Check

Quiz

Answer these before checking the revision notes above — if you can explain the 'why' behind each, you're ready.

Q1

A producer publishes with routing key "orders.created" to a topic exchange with a binding pattern "orders.*" — does it match? What about "orders.#"? (Answer: both match — * matches the single word 'created'; # matches zero-or-more words including exactly one.)

Q2

You set prefetch=0 on a consumer. What happens under a burst of 10,000 messages with only one consumer online? (Answer: prefetch=0 removes the QoS limit, so the consumer can accumulate a very large unacknowledged backlog — actual delivery is still constrained by transport/client/broker flow, but there's no broker-enforced cap, which risks consumer memory pressure and a large redelivery blast radius if it crashes.)

Q3

A queue has no DLX configured and a consumer keeps rejecting the same malformed message with requeue=true. What happens? (Answer: infinite requeue loop — the message keeps being redelivered forever, consuming consumer capacity with no resolution. If it were rejected with requeue=false instead, dead-lettering or discard would apply per the queue's configuration.)

Q4

Why can't a standard RabbitMQ queue replay a message to a second consumer group the way Kafka can? (Answer: RabbitMQ deletes a message once ACKed by its consumer — there's no retained log to replay from under normal queue semantics; a second queue would need to exist via a binding before the message was published. RabbitMQ Streams provide a different retained/replayable model if that capability is genuinely needed.)

04 · Reference

Cheat Sheet

textExchange types at a glance
direct   → exact routing-key match
fanout   → broadcast, routing key ignored
topic    → wildcard match (* = one word, # = zero+ words)
headers  → match on message header key/value pairs
textDelivery reliability (producer → broker → consumer)
[ ] publisher confirms enabled
[ ] appropriate durable/replicated queue type
[ ] message published with delivery_mode=2 (persistent)
[ ] consumer uses manual ACK (basic.ack)
[ ] duplicate handling is idempotent at the consumer
textFailure handling (separate concern)
[ ] retry policy with backoff for transient failures
[ ] dead-letter strategy (DLX + DLQ) where failed work must be inspected or recovered
[ ] retry attempts capped (custom header / x-death count)
textPrefetch quick reference
prefetch=1  → fairest dispatch across consumers, lowest per-consumer throughput ceiling
prefetch=N  → more buffering/concurrency potential; tune from measured workload, no universal default
prefetch=0  → QoS limit removed — risks large unacked backlog and big redelivery blast radius on crash
textRabbitMQ vs Kafka, one line each
RabbitMQ → reliable task delivery, complex routing, deletes after ACK
Kafka     → durable log, replay, many independent consumer groups