Video in progress
You need to choose between Kafka and RabbitMQ. What criteria do you look at?
Kafka is a retained, replayable log: for large event streams, event sourcing, and several independent consumer groups. RabbitMQ is a classic queue: handy for complex routing, per-message acks and distributing jobs to workers.
📖 Answer
The main difference is in the model.
In Kafka, a message isn't deleted after it is read. It sits in the partition for the retention period, and each consumer group keeps its own offset. If a new service is added, it can read the old events from the beginning. Order is guaranteed within a partition. Throughput is very high, because writes to disk are sequential.
In RabbitMQ, a message goes into a queue and is deleted once the consumer acks it. Routing is very flexible with exchange types (direct, topic, fanout, headers). Retry, TTL, priority and dead-lettering are available per message.
| Need | Better fit |
|---|---|
| Billions of events a day, analytics, CDC | Kafka |
| Replaying events | Kafka |
| Work queue: "generate a PDF", "send an email" | RabbitMQ |
| Complex routing, delayed messages | RabbitMQ |
| Strict ordering by key | Kafka (partition key) |
There's a practical side as well: what does the team know, and who will run it in production? On a small project, RabbitMQ is easier to bring up and understand. Setting up Kafka properly (partition count, replication, consumer lag monitoring) takes more experience.
Both are as reliable as you need. The choice isn't "which one is better", it's "which model fits your problem".
Sign up to mark studied questions and save your progress.