EN
Free assessment

Blog · RabbitMQ

RabbitMQ vs Kafka: Which Message Broker Fits Your System

RabbitMQ is a queue broker: it delivers each message to one consumer, routes through exchanges and removes the message after the ack. Kafka is a distributed log: it keeps events for a configurable time and each consumer group rereads what it needs. For tasks and commands, RabbitMQ is usually enough. For streaming, replay and very high volume, choose Kafka.

The RabbitMQ vs Kafka question comes up in almost every project with more than one service. The short answer is that they solve different problems, even though they overlap in some cases. We have built custom software since 2008, and RabbitMQ runs in production in 15 of our systems today. This article compares the two on the criteria that change the decision in practice: delivery model, ordering, retention, throughput and consumers.

The mental model of each one

RabbitMQ is a message broker. The producer publishes to an exchange, the exchange routes to one or more queues by rule (direct, topic, fanout, headers) and consumers read from the queues. When the consumer acknowledges (ack), the message leaves the queue. The broker knows the state of every message: ready, in delivery, acknowledged, rejected.

Kafka is a partitioned, distributed log. The producer appends records to the end of a topic partition. The records stay there for the configured time or size, whether anyone has read them or not. Each consumer keeps an offset, the position it has read up to. The broker does not track the state of each message, only the offsets of each group.

This difference explains almost everything that follows.

Delivery model

In RabbitMQ, the default is push with prefetch. The broker pushes messages to the consumer up to the limit of unacknowledged messages (prefetch). That gives natural load balancing: faster consumers receive more. With publisher confirms on the producer and manual ack on the consumer, the semantics are at-least-once. A message can arrive twice after a failure, so the consumer must be idempotent.

In Kafka, the consumer pulls from the log and commits offsets. At-least-once is the natural behavior when the commit happens after processing. Kafka offers exactly-once inside Kafka itself, with idempotent producers and transactions, but that covers Kafka-to-Kafka flows. When you write to a database or call an API, idempotency is your code’s job again.

In short: with either one, design for repeated delivery.

Ordering

Kafka keeps order within a partition. Records with the same key go to the same partition, so all events for one order or one customer arrive in order. There is no global order across partitions. The maximum parallelism of a group is the number of partitions.

RabbitMQ delivers in publish order within a queue with one consumer. With several competing consumers, completion order varies. If a message fails and returns to the queue, it can be reprocessed after others. To order per entity, the options are one queue per logical key, the consistent hash exchange plugin, or single active consumer mode, which keeps one consumer active per queue and holds the others on standby.

If strict per-key ordering with high parallelism is the heart of the problem, Kafka serves you with less effort.

Retention and replay

Here the gap is widest. In Kafka, the topic is the source of truth for a period: hours, days or indefinitely, with key compaction. A new consumer can start from the beginning. A processing bug is fixed by resetting the offset and rereading. This supports event sourcing, CDC and data pipelines.

In RabbitMQ, an acknowledged message is gone. To reprocess, you must have stored the message elsewhere or use streams, the log-based queue type RabbitMQ has offered since the 3.9 series. Streams bring RabbitMQ closer to the Kafka model, with offset-based reads and retention, but with a smaller ecosystem of clients and tools.

If replay is a business requirement, look at Kafka or streams first.

Throughput and latency

Kafka was designed for sequential disk writes and batched reads. With many partitions and batching producers, aggregate throughput is very high. The price is slightly higher end-to-end latency when batching is on.

RabbitMQ prioritizes individual delivery with low latency and rich routing. Per-queue throughput is bounded by the work one node does to coordinate the queue, and quorum queues (Raft-based) pay the cost of replication and fsync. In exchange, they deliver strong durability and consistency. To scale, you spread load across several queues.

In our experience, most enterprise systems come nowhere near the ceiling of either one. The bottleneck is usually the database or the external call the consumer makes. Measure with real load before deciding on throughput.

Routing, priority and retry

RabbitMQ has the edge on work-queue features:

  • Exchanges with topic, header and fanout routing.
  • TTL per message or per queue.
  • Dead-letter exchange for rejected or expired messages.
  • Message priority: on classic queues and, since RabbitMQ 4.0, at two levels (normal and high) on quorum queues.
  • Delivery limit on quorum queues, to stop poison messages.

In Kafka, delayed retry and dead-lettering are patterns you implement with extra topics (orders.retry.1m, orders.dlq) and consumer code. It works, and it takes effort. There is also no per-message priority: one slow message in a partition blocks the ones behind it (head-of-line blocking).

Consumers and scaling

In RabbitMQ, adding consumers to a queue splits the work immediately. Any number works, with no partition planning. A single event can feed several services with one queue per service bound to a fanout or topic exchange.

In Kafka, each consumer group reads the whole topic independently, and within a group the partitions are divided among members. Scaling beyond the partition count does not help, and changing the partition count later affects per-key ordering. Plan the count with headroom. Group rebalances also cause pauses that the consumer must tolerate.

Operations

Modern Kafka runs without ZooKeeper, in KRaft mode. It still demands care with replication factor, min.insync.replicas, disk retention, partition size and per-group lag monitoring. Managed services lift part of that weight.

RabbitMQ is quick to start and easy to understand. The points of attention are queues that grow with no consumer, memory and disk alarms, quorum queue policies, and choosing between classic queues, quorum queues and streams for each use case. On Kubernetes, the official operator handles much of this. We run more than 250 workloads on Kubernetes and treat the broker like any other component, with monitoring, alerts and failure tests.

When to choose each one

RabbitMQ is the natural choice when:

  • messages are commands or tasks (send an email, issue an invoice, process a payment);
  • you need flexible routing, priority, TTL and dead-lettering out of the box;
  • the team wants to move fast and the volume is moderate to high, but not data-platform scale;
  • the message is short-lived and no longer matters once processed.

Kafka is the natural choice when:

  • the event is a fact that must be stored and reread (audit, CDC, event sourcing);
  • several teams consume the same flow at different paces;
  • the volume is telemetry, clicks, logs or continuous ingestion;
  • the processing is stream-based, with joins and windows.

Both together work well in larger platforms: Kafka as the event backbone and RabbitMQ for each service’s work queues. In our daily work, a .NET worker on RabbitMQ processes asynchronous tasks on the Regina Festas platform. Read the story in the Regina Festas case study.

A simple way to decide

Ask four questions:

  1. Will anyone need to reread old messages? If yes, Kafka or streams.
  2. Is the message a job to execute with retry and a deadline? If yes, RabbitMQ.
  3. Are more than ten teams consuming the same flow? Kafka tends to pay off.
  4. Which one does your team know how to operate? Operational experience weighs more than a benchmark table.

When in doubt, start with the simplest option that meets the requirement. Moving from queues to streams, or from RabbitMQ to Kafka, is feasible once the domain is clear, and a design with idempotent events and versioned contracts lowers that cost.

How we can help

We design and operate messaging in custom software: broker choice, queue topology, retry and dead-letter policy, idempotency and observability. See our RabbitMQ consulting expertise and our custom software development service. If you have a system where the choice is still open, the free assessment puts the conversation on your real architecture, with scope and timeline in weeks. If you plan to build on RabbitMQ with .NET, read our RabbitMQ .NET tutorial.

FAQ

Questions on this topic

RabbitMQ or Kafka: which one is faster?

It depends on what you measure. Kafka writes to a sequential log and reaches higher aggregate throughput across many partitions. RabbitMQ has low per-message latency and flexible routing. In most enterprise systems the bottleneck is the consumer and the database, not the broker.

Does RabbitMQ keep message order?

In a queue with a single consumer, delivery order follows publish order. With several consumers, or with requeue after a failure, processing order is no longer predictable. If order matters per entity, use one queue per logical partition or the consistent hash exchange plugin.

Can I use RabbitMQ and Kafka in the same system?

Yes, and it is common. Kafka carries the high-volume event stream and analytics. RabbitMQ handles commands, async tasks and integrations that need routing, priority and retry with dead-lettering. The bridge between the two needs idempotency on both sides.

Can Kafka replace a queue?

It can simulate one, at a cost. Kafka has no per-message ack, per-message retry or dead-lettering built in. You build those with retry topics and consumer logic. For simple work queues, RabbitMQ ships them ready to use.

Which one costs more to operate?

Kafka tends to need more planning: partitions, replication, retention and consumer group rebalancing. RabbitMQ is simpler to stand up, but it needs attention to long queues, memory and quorum queue policy. In both cases, monitoring from day one prevents surprises.

Tell us what you need to build.

Ask for a free assessment and get a clear path for your project, with no commitment.

Free assessment