Skip to content

RabbitMQ vs Kafka

RabbitMQ and Kafka both move messages between services, but they are built on opposite ideas, and the difference decides which one you should use.

  • RabbitMQ is a smart broker with a dumb consumer. The broker does the hard work — routing, tracking who has acknowledged what, redelivering failures. A message is delivered, acknowledged, and then removed. The consumer just processes and acks.
  • Kafka is a dumb broker with a smart consumer. The broker is essentially an append-only log: it writes messages to disk and keeps them. It does no routing and forgets nothing on consume. Each consumer tracks its own position (an offset) and can rewind and re-read.

That one difference — remove on ack versus retain and track offsets — cascades into everything else.

flowchart TB
  subgraph rmq["RabbitMQ — queue"]
    m1["msg"] --> qd["deliver"] --> ackd["ack"] --> gone["removed"]
  end
  subgraph kafka["Kafka — log"]
    log["[0][1][2][3][4] retained"]
    ca["consumer A at offset 2"] --> log
    cb["consumer B at offset 4"] --> log
  end
Consume-and-delete queue vs a retained log with offsets
RabbitMQKafka
Core modelQueue — deliver then deleteLog — append and retain
Broker roleSmart: routes, tracks acks, redeliversSimple: stores an ordered log
After consumeMessage removed on ackMessage retained; offset advances
ReplayNo (it’s gone once acked)Yes — rewind the offset and re-read
RoutingRich (direct/topic/fanout/headers)By partition/topic; logic in consumers
OrderingPer queueStrong within a partition
ThroughputHigh; excels at complex routingVery high; built for firehose streams
Best atTask distribution, RPC, complex routing, per-message workflowsEvent streaming, replay, analytics pipelines, huge throughput

Reach for RabbitMQ when you have discrete units of work to distribute, need rich routing, or want per-message acknowledgement and retry — background jobs, order processing, request/reply. The message is a task that gets done once and disappears.

Reach for Kafka when you have a stream of events that many independent systems consume at their own pace, when you need replay (a new consumer reprocesses history), or when throughput is enormous — event sourcing, activity streams, metrics pipelines. The message is a fact recorded in a log that stays.

And often the right answer is both: Kafka as the durable event backbone, RabbitMQ for task queues and RPC between services. They are not competitors so much as different tools.

What happens to a message in RabbitMQ after a consumer acknowledges it?
How does a Kafka consumer track what it has read?
Which workload is a better fit for Kafka than RabbitMQ?
Which statement best captures the core difference?