RabbitMQ vs Kafka in 2026: when to use which

Short answer

Use RabbitMQ when each message is a job or command that one worker should process and acknowledge, especially if you need routing rules, per-message TTLs, priorities or dead-lettering in the broker. Use Kafka when events must be kept, replayed and read independently by several services, or fed into stream processing and change data capture. The line is less sharp than it was: RabbitMQ streams give replayable logs, and Kafka 4.2 made share groups (“Queues for Kafka”) production-ready. RabbitMQ 4.0 removed classic queue mirroring in favour of quorum queues, and Kafka 4.0 removed ZooKeeper. Both are free open source; the real cost is operating them or paying for a managed service.

Jump to: decision framework · worked example · migration plan · how we can help

Designing an event or messaging architecture? Get a free 30-minute advisory call.

The core difference: a broker of queues vs a replicated log

RabbitMQ is a message broker. Producers publish to an exchange, the exchange routes each message to one or more queues using bindings, and consumers take messages off those queues. Once a consumer acknowledges a message in a classic or quorum queue, it is gone. The broker does the work of routing, tracking delivery and redelivering on failure.

Apache Kafka is a distributed, replicated commit log. Producers append records to a topic, which is split into partitions. Records stay on disk for a configured retention period whether or not anyone has read them. Each consumer group tracks its own offset in each partition, so ten different services can read the same stream independently, and any of them can rewind and replay.

Most of the practical differences follow from that one design choice. RabbitMQ is built to deliver each message to the right worker and forget it. Kafka is built to keep an ordered history that many readers can process at their own pace.

RabbitMQ vs Kafka side by side

Dimension RabbitMQ Kafka
Data model Exchanges route to queues; streams as an append-only option Topics split into partitions; append-only log
After consumption Message removed from a queue once acknowledged (streams keep it) Record kept until retention time or size limit, independent of reads
Replay Not for queues; supported on RabbitMQ streams Built in: reset a consumer group offset to a time or position
Routing Rich: direct, topic, fanout and headers exchanges, bindings, alternate exchanges Producer chooses topic and (via key) partition; routing logic lives in apps or stream processors
Ordering Per queue; strict ordering needs a single active consumer Per partition; records with the same key stay in order
Scaling consumers Add consumers to a queue; competing consumers share the work Consumer groups: parallelism capped by partition count. Share groups (Kafka 4.2+) remove that cap for queue-style work
Failed messages Native dead-letter exchanges, per-message and per-queue TTL, delivery limits on quorum queues Dead-letter topics are an application pattern; share groups add delivery-attempt counting
Protocols AMQP 0-9-1, AMQP 1.0 (core since 4.0), MQTT, STOMP, stream protocol Kafka wire protocol (many compatible servers and managed services)
Replication Quorum queues and streams (Raft-based); classic queues are single-replica since 4.0 Partition replicas with in-sync replica sets; KRaft controllers for metadata
Typical sweet spot Task queues, RPC, command messages, IoT fan-in over MQTT Event streaming, change data capture, analytics pipelines, event sourcing

What changed recently (and why older comparisons are out of date)

Many “RabbitMQ vs Kafka” articles predate several large changes on both sides. Before you rely on one, check its date against these.

RabbitMQ 4.x

The RabbitMQ 4.0 release notes list three changes that matter for this comparison. Classic queue mirroring was removed after years of deprecation: classic queues are now single-replica, and replicated messaging uses quorum queues or streams. AMQP 1.0 became a core, always-on protocol. And Khepri, a Raft-based metadata store built to replace Mnesia, moved from experimental to fully supported. Quorum queues also gained message priorities in 4.0. The current release line is 4.4 (4.4.1 shipped in November 2026).

Streams, added back in the 3.9 series, matter most here. A RabbitMQ stream is an append-only, replicated log that consumers can read from any offset, so RabbitMQ can now handle some replay and fan-out work that used to need Kafka.

Kafka 4.x

Kafka 4.0 removed ZooKeeper; clusters run in KRaft mode, where a quorum of Kafka controllers manages metadata. That takes one whole distributed system out of a Kafka deployment. Then the Kafka 4.2 release announcement (February 17, 2026) declared Queues for Kafka (share groups, KIP-932) production-ready. Consumers in a share group can read the same partitions together, with per-record acknowledgement and delivery-attempt counts, so there can be more consumers than partitions. The 4.2 upgrade notes say share groups are meant for records “processed one at a time, rather than as part of an ordered stream”. The current release is 4.4.0, from October 22, 2026, per the Kafka downloads page.

The net effect: the old rule “RabbitMQ for queues, Kafka for streams” still holds as a default, but both products now cover part of the other’s ground. RabbitMQ has replayable streams, and Kafka has queue semantics. The deciding factors are now routing needs, retention and replay, team skills and operating model, rather than a missing feature.

When RabbitMQ is the better choice

  • Background jobs and work queues. Image processing, email sending and report generation, where each job should be done once by any available worker, with acknowledgements, redelivery and a dead-letter exchange for poison messages.
  • Routing logic in the broker. Topic exchanges with wildcard bindings (orders.*.eu) and headers exchanges let you change who receives what without redeploying producers.
  • Request/reply and command messaging between services, where latency per message matters more than throughput of a firehose.
  • Per-message controls: TTLs, priorities and delivery limits per queue or per message.
  • Mixed protocols. Devices speaking MQTT and back-end services speaking AMQP can meet in the same broker.
  • Smaller teams. A three-node RabbitMQ cluster with quorum queues is a modest operational footprint, and the management UI makes queues and consumers easy to inspect.

When Kafka is the better choice

  • Several independent consumers of the same events. Billing, analytics, search indexing and notifications each read the same order-placed topic at their own pace, without the producer knowing about them.
  • Replay and reprocessing. Fix a bug in a consumer, reset its offset and rebuild its state from history.
  • Change data capture. Streaming database changes (for example with Debezium) into a log that downstream systems subscribe to.
  • Stream processing. Kafka Streams, Apache Flink and similar tools treat Kafka topics as their native input and output.
  • High sustained throughput with long retention. Partitioned, sequential disk writes and tiered storage (offloading older segments to object storage) suit large volumes kept for days or weeks.
  • An event backbone across many teams, where the log becomes the shared record of what happened.

Using both, and the patterns that make either work

Running both is common and reasonable: Kafka as the event backbone between domains, RabbitMQ inside a service for task distribution. A bridge (a small consumer that reads a Kafka topic and publishes jobs to RabbitMQ, or a connector) keeps the boundary explicit.

Whichever broker you choose, three patterns prevent most production incidents:

  • Transactional outbox. Write the business change and the outgoing event in the same database transaction, then publish from the outbox table. This avoids “saved the order but lost the event” and the reverse.
  • Idempotent consumers. Both systems give at-least-once delivery in normal configurations, so consumers must tolerate duplicates, typically by recording processed message IDs. Kafka’s exactly-once transactions cover Kafka-to-Kafka processing, not side effects such as sending an email.
  • Explicit failure paths. Configure dead-lettering in RabbitMQ, and in Kafka publish failures to a retry or dead-letter topic (or use share-group delivery counts). Alert on the depth of those destinations.

Operating cost and managed options

Neither product has a licence fee in its open-source form; RabbitMQ is MPL 2.0 and Kafka is Apache 2.0. The cost is infrastructure and people.

Concern RabbitMQ Kafka
Minimum sensible HA cluster Three nodes for quorum queues and streams Three brokers plus KRaft controllers (combined or dedicated)
Main capacity planning questions Queue depth and memory, message size, consumer ack rates Partition count, retention size, replication factor, disk throughput
Common failure mode Queues growing without bound when consumers fall behind, triggering memory or disk alarms Under-partitioned topics capping consumer parallelism; consumer lag; rebalancing storms
Managed services Amazon MQ for RabbitMQ, CloudAMQP and others Amazon MSK, Confluent Cloud, Aiven and Kafka-compatible services such as Redpanda

Managed prices vary by instance size, throughput and region, and we do not reproduce them here; check each provider’s official pricing page against your expected message rate, retention and partition count. If you already run Redis for lightweight queues, our Valkey vs Redis guide covers where that stops being enough.

A five-question decision checklist

Answer these before choosing

  • Does more than one independent service need the same events? If yes, lean Kafka (or RabbitMQ streams).
  • Do you need to replay history to rebuild state or backfill a new consumer? If yes, lean Kafka.
  • Is the main workload discrete jobs that should each be done once, with retries and dead-lettering? If yes, lean RabbitMQ.
  • Do you need routing rules that change without touching producers? If yes, lean RabbitMQ.
  • Who will run it at 3 a.m.? Pick the system your team can operate, or buy it managed.

If the answers split, that is usually a sign you have two workloads and may want both systems, each doing what it is good at.

Decision framework: map workloads, not products

Most “RabbitMQ or Kafka” debates stall because they compare products. Compare workloads instead. List the message flows in your system, give each one a row, and choose per row. Mixed answers are normal.

WorkloadDefault choiceWhyWhat would change the answer
Background jobs: emails, image processing, report generationRabbitMQ (or Kafka share groups if Kafka is already your backbone)Each job is done once by any free worker, with acknowledgement, redelivery and a dead-letter exchangeYou need to replay old jobs from history, which points to a stream
Domain events several services consume (order placed)Kafka, or a RabbitMQ streamEach consumer group keeps its own offset and can replayOnly one consumer and no replay: a queue is simpler
Change data capture from a databaseKafkaDebezium and stream processors are built around Kafka topics, with ordering per keyVery low volume with one consumer: a direct integration may be enough
Request/reply or command messages between servicesRabbitMQReply queues, per-message TTL and routing in the brokerIf one service calls one other and can wait, plain HTTP or gRPC may need no broker
Device telemetry over MQTTRabbitMQ at the edge, Kafka behind it if you also need long retentionRabbitMQ speaks MQTT and AMQP in one brokerYou only need analytics: send straight to your streaming platform
Audit trail or event sourcingKafkaDurable, ordered history that readers can rewindStrict legal retention needs a purpose-built store as well
Delayed retries and scheduled workRabbitMQ with TTL and dead-letteringRetry-after-delay is a broker patternLong timers, multi-step state and compensation: use a workflow engine (see our Temporal Cloud pricing guide)

Tie-breakers when two rows disagree

  • Ordering. Kafka orders per partition and per key. If you need global order, you are limited to one partition or one queue and one consumer.
  • Team skills and on-call. Choose the system your team can restore at 3 a.m., or buy it managed.
  • Protocols. MQTT, STOMP or AMQP clients already in the field favour RabbitMQ.
  • Retention cost. Kafka’s disk grows with retention, as the worked example below shows. If nobody replays, you may be paying for history you do not read.

When to choose neither

A managed queue such as Amazon SQS, or the queue features of your database or cache, may be enough for modest volumes and one consumer, with no broker to run. Our Valkey vs Redis guide covers where Redis-style queues stop being enough. Reach for a broker when you need routing, replay, fan-out or per-message controls.

Worked example: sizing one workload on both brokers

EXAMPLE: hypothetical workload. The inputs are assumptions, not data from a client or a benchmark. Both brokers are free to run and managed prices vary by provider, so this example uses no vendor prices: it sizes quantities (disk, traffic, partitions) that you then price on your provider’s official page.

Assumed workload: 2,000 messages per second at peak, held as a worst case all day; 1 KB (1,000 bytes) per message; three services consume every message; Kafka keeps 7 days with replication factor 3; one consumer instance handles 500 messages per second (an assumption you would measure in a load test).

QuantityCalculationResult
Producer traffic2,000 × 1,000 bytes2 MB/s
Data per day at that peak2 MB/s × 86,400 s172.8 GB (an upper bound; real traffic has quiet periods)
Kafka disk, 7 days, one copy172.8 GB × 71,209.6 GB (about 1.2 TB)
Kafka disk with replication factor 31,209.6 GB × 33,628.8 GB (about 3.6 TB), roughly 1.2 TB on each of three brokers, before headroom and overhead
Same disk with 1-day retention172.8 GB × 1 × 3518.4 GB
Kafka network at peakIn: 2 MB/s. Replication to two followers: 2 × 2 MB/s. Three consumer groups out: 3 × 2 MB/s2 MB/s in, 4 MB/s replication, 6 MB/s out
Consumer instances to keep up2,000 ÷ 5004 instances, so at least 4 partitions in the classic consumer-group model; plan more for headroom
RabbitMQ backlog if consumers stop for 10 minutes (one queue)2,000 × 600 s × 1 KB1.2 million messages, about 1.2 GB; about 3.6 GB across three quorum-queue replicas
RabbitMQ with three bound queues (one per consuming service)3 × 1.2 GB backlog, then × 3 replicas3.6 GB, then about 10.8 GB across replicas
RabbitMQ steady stateQueues drain as messages are acknowledgedNear zero if consumers keep up

What the example shows

  • Retention, not throughput, sets Kafka’s disk. 2 MB/s is a modest rate for a broker. Seven days of it with three copies is about 3.6 TB. Cutting retention to one day cuts that to 518.4 GB.
  • Queues hold backlog, not history. A RabbitMQ queue only grows when consumers fall behind, so alert on queue depth and set length limits or TTLs so a stalled consumer cannot fill the disk.
  • Partitions are a parallelism budget. You can add partitions later but not remove them, and adding them changes which partition a key lands on, which matters when you rely on per-key order. Choose from measured per-consumer throughput plus headroom.
  • Fan-out costs differ. Kafka serves three consumer groups from one copy of the data. RabbitMQ gives each consuming service its own queue, so backlog is stored once per queue.
  • Next step: take these quantities (disk, throughput, partitions, retention) to the managed providers’ official pricing pages, or to your own infrastructure costs for self-hosting.

Get a sizing sheet for your workload

Share your message rate, message size, consumers and retention needs. We will send a sizing and topology recommendation using this method.

Migration plan: phases, risks and exit criteria

This plan covers adding Kafka beside RabbitMQ, moving a flow from one to the other, or introducing a broker for the first time. We do not quote standard durations: they depend on the number of flows, consumers and teams. The inventory sets the estimate and the first migrated flow tests it.

PhaseWhat happensMain riskExit criteria
0. Inventory flowsList every producer, queue or topic, consumer, message schema, ordering need and failure pathUndocumented consumers and scripts reading the same queueEach flow has an owner, a contract and an agreed target
1. Define contractsFix message schemas, versioning rules, keys and idempotency keys; choose a schema registry or equivalentProducers and consumers change schemas independently and break each otherSchema and compatibility rules agreed and tested in CI
2. Stand up the targetThree-node HA cluster, authentication, TLS, quotas, backups, metrics and alerts on consumer lag or queue depthA cluster that works in a demo but has no operations storyFailover and restore tested; alerts reach on-call
3. Dual-publishWrite events from the transactional outbox, or run a bridge that republishes, to old and new systemsDuplicates and ordering differences between systemsReconciliation counts match for a full business cycle
4. Move consumers one by oneMake consumers idempotent, then switch each flow to the new system, starting with the least criticalPoison messages, retry storms and rebalancing after the switchEach flow runs on the new system with a dead-letter path and alerts
5. Move producers and retireStop publishing to the old system, drain it, keep it read-only for a period, then remove itA forgotten producer keeps writing to the old systemOld queues or topics empty and unused; credentials revoked

Common mistakes with RabbitMQ and Kafka

  • Using Kafka as a task queue without share groups. With the classic consumer-group model one slow record can hold up its partition, and parallelism is capped by partition count.
  • Too few partitions. In the classic consumer-group model parallelism is capped by partition count, and adding partitions later changes where keys land. Size from measured throughput plus headroom.
  • Unbounded RabbitMQ queues. Without length limits, TTLs and alerts, a stuck consumer fills memory or disk and triggers broker alarms for everyone.
  • No dead-letter path. One poison message can block a queue or loop forever. Decide where failed messages go and alert on the depth of that destination.
  • Assuming exactly-once covers side effects. Kafka transactions cover Kafka-to-Kafka processing, not sending an email or charging a card. Make consumers idempotent.
  • Publishing without an outbox. A database commit and a broker publish are two writes. Use a transactional outbox so you cannot save the order and lose the event.
  • Default retention. Leaving retention at whatever the platform defaults to turns into a disk and cost surprise. Set it from the arithmetic above.
  • One giant topic or queue for everything. Separate flows by contract and ownership so one team’s change cannot stall another’s.

Planning checklist before you choose

Planning checklist

  • Every message flow listed with owner, schema, ordering need and expected peak rate
  • Replay need decided per flow, with the retention period it implies
  • Disk, network and partition arithmetic done for peak, and reviewed with someone who will operate it
  • Idempotency keys defined, and consumers tested against duplicate delivery
  • Transactional outbox or equivalent in place for events tied to database writes
  • Dead-letter or retry destination defined per flow, with alerts on its depth
  • Alerts on consumer lag (Kafka) or queue depth (RabbitMQ) wired to on-call
  • Schema evolution and compatibility rules agreed
  • Managed or self-hosted decision made, with the monthly cost priced from the provider’s official page
  • Failover, restore and upgrade runbooks written and rehearsed
  • Owner named for upgrades, capacity and incidents

How MobileFirst helps with messaging architecture

We are an engineering practice and do not resell either product. We help teams decide which broker (or both) fits each flow, then build and run it:

1. Assess

We map your message flows to workloads, size disk, throughput and partitions with the method above, compare managed and self-hosted options against your provider’s official pricing, and give you a reference topology and a failure-handling design.

2. Implement

We build the platform and the surrounding patterns: outbox publishing, idempotent consumers, dead-letter and retry paths, schema contracts, alerts on lag and depth, and infrastructure as code. This sits within our data engineering and application engineering practices.

3. Migrate and run

We run dual-publishing, move consumers flow by flow, reconcile counts, retire the old path, and hand over runbooks. If you want operations covered afterwards, our managed service handles monitoring and incident response under SLA.

Engagement options are a fixed-scope project, a dedicated pod or a managed service; see our engagement models. Operations side: IT operations and service desk. Related reading: Datadog alternatives for monitoring lag and depth.

Designing or migrating a messaging backbone?

Book a free 30-minute call. Bring your flow list, or just your message rates and retention needs, and we will tell you what we would size and test first.

Book a 30-minute call   Send us your details

Frequently asked questions

Is Kafka better than RabbitMQ?

Neither is better in general. Kafka is better for event streaming, replay, many independent consumers and long retention. RabbitMQ is better for task queues, request/reply, per-message routing and dead-lettering with a smaller operational footprint. Since Kafka 4.2 added production-ready share groups and RabbitMQ added streams, each covers part of the other’s ground.

Can Kafka be used as a queue?

Yes. Queues for Kafka (share groups, KIP-932) became production-ready in Apache Kafka 4.2, released February 17, 2026. Consumers in a share group cooperatively consume the same partitions with per-record acknowledgement and delivery counting, so consumers can outnumber partitions. Ordering across a share group is not guaranteed.

Can RabbitMQ replay messages like Kafka?

Queues cannot: an acknowledged message is removed. RabbitMQ streams can. A stream is an append-only, replicated log that consumers can read from any offset, which covers many replay and fan-out use cases.

Does Kafka still need ZooKeeper?

No. Kafka 4.0 removed ZooKeeper, and clusters now run in KRaft mode, where Kafka controllers manage metadata with a Raft-based quorum.

Does RabbitMQ still support mirrored queues?

No. RabbitMQ 4.0 removed classic queue mirroring. Classic queues still work but are single-replica. For replication, use quorum queues or streams.

Should I use RabbitMQ or Kafka for microservices?

Use RabbitMQ for commands and background jobs between a small number of services, and Kafka for domain events that several services consume independently or that you may need to replay. Many systems use both, with the transactional outbox pattern and idempotent consumers either way.

How many partitions should a Kafka topic have?

Start from peak throughput divided by what one consumer instance can handle, which you should measure in a load test, then add headroom. In the worked example, 2,000 messages per second at 500 per instance needs at least 4 partitions. You can add partitions later but not remove them, and adding them changes which partition a key maps to.

How much disk does a Kafka topic need?

Message rate × message size × seconds of retention × replication factor, plus headroom. For 2 MB/s kept for 7 days with three replicas that is about 3.6 TB. Retention and replication, not throughput alone, decide the figure.

How do I migrate from RabbitMQ to Kafka without losing messages?

Dual-publish through a transactional outbox or a bridge, make consumers idempotent, move consumers one flow at a time, reconcile counts over a full business cycle, then stop the old publisher and keep the old queues read-only for a period before removing them.

Choosing a messaging backbone?

Tell us your message rates, retention needs and how many services consume each stream. We will recommend RabbitMQ, Kafka or both, with a reference topology and the failure-handling patterns to build in from day one.

We'll get back to you shortly. We use your details only to reply to this request.