Kafka or RabbitMQ?

Queues, Kafka and event-driven systems Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Pick the fix

Analytics, billing and a new fraud service must each read all order events, and fraud must replay the last 30 days on launch. Pick:

Options
Hint 1 of 1

Who needs history?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Kafka with 30-day retention

Correct. Every consumer group reads independently and a new one can start from the beginning.

Kafka keeps messages for the retention period whether or not they've been read, and each consumer group has its own offset. A new group can start at the oldest offset and replay 30 days.

Why not the others?
  • B RabbitMQ classic queues. Acknowledged messages are gone; the new service can't replay.
  • C Redis pub/sub. No retention at all.
  • D A cron job that copies tables. Not an event stream.

30-second answer

Kafka is a replicated, partitioned log: messages stay for a retention period whether or not they're consumed, consumers track their own offsets and can replay, and throughput is very high. It suits event streams, many independent consumers and reprocessing. RabbitMQ is a broker that routes messages to queues and deletes them once acknowledged, with flexible routing, per-message acknowledgements, priorities and delays. It suits task queues and request routing.

Practise saying it · 30 s. No recording, just a timer

Kafka or RabbitMQ?

Say your answer out loud, then check which of these points you covered:

  • Log with retention vs broker
  • Replay vs delete on ack
  • Throughput and many groups
  • Routing, priorities, delays

Deep dive

Kafka 4 runs without ZooKeeper (KRaft only).

RabbitMQ streams and quorum queues narrow the gap but the models differ.

Per-message retry and delay are simple in RabbitMQ and need extra topics in Kafka.

Managed options (Amazon SQS/SNS, Google Pub/Sub) remove operations work when their limits fit.

Common mistakes

  • Picking Kafka for a small job queue.
  • Picking RabbitMQ when consumers need to replay last week's events.
  • Choosing by popularity instead of the delivery model you need.

Senior take & follow-ups

Log vs broker, retention and replay vs routing and per-message acks, then match to use cases.

Follow-up questions

Think of your answer first, then open the hint.

  1. Can RabbitMQ replay?

    Show hint

    Classic queues delete acknowledged messages; streams can.

  2. Does Kafka still need ZooKeeper?

    Show hint

    No: Kafka 4 is KRaft-only.

Suggest a fix if something here is wrong or out of date.