RabbitMQ

Architecture

Understand RabbitMQ as a smart broker built on the AMQP model: exchanges route, queues store.

RabbitMQ is a traditional message broker implementing the AMQP 0-9-1 model. Unlike Kafka, the broker is "smart" and does the routing work, while consumers are relatively simple. The core insight is the separation between exchanges and queues: producers never publish directly to a queue, they publish to an exchange, which decides which queue(s) receive the message based on bindings.

A mailroom: you drop a letter at the sorting desk (exchange) with an address (routing key). The clerk consults the routing chart (bindings) and places it into the correct pigeonholes (queues), where recipients (consumers) collect and sign for it.

Key Concepts

1
A queue is an ordered buffer that holds messages until a consumer acknowledges them. Once all consumers have acknowledged a message, it is gone — there is no replay of consumed messages as in Kafka. This makes RabbitMQ a natural fit for task distribution and request/reply.
2
RabbitMQ supports rich routing, per-message TTL, priorities, dead-lettering, and flexible delivery, at the cost of lower raw throughput than Kafka. Clustering and quorum queues provide high availability.
3
What the interviewer is probing.
What the interviewer is probing.
4
1. "What are the core components?" *Probing:* the vocabulary. *Stalls:* "Queues." *Moves up:* producer, exchange, binding, queue and consumer — the exchange and binding are what distinguishes it from a plain queue.
1. "What are the core components?"
5
2. "Why publish to an exchange rather than a queue?" *Probing:* the central idea. *Stalls:* "Convention." *Moves up:* the producer does not need to know the consumers — routing is configuration, so a new consumer binds without a producer change.
2. "Why publish to an exchange rather than a queue?"
6
3. "What is a virtual host?" *Probing:* the detail. *Stalls:* "A server." *Moves up:* a logical namespace with its own exchanges, queues and permissions, used to separate environments or tenants on one broker.
3. "What is a virtual host?"
7
4. "Where is the message actually stored?" *Probing:* the mechanism. *Stalls:* "The exchange." *Moves up:* in the queue — an exchange holds nothing, it routes, which is why a message published with no matching binding is dropped.
4. "Where is the message actually stored?"