RabbitMQ vs Kafka: Key Differences, Use Cases and How to Choose
RabbitMQ is a message broker and Kafka is a distributed log. A RabbitMQ producer publishes to an exchange, the exchange's bindings decide which queues receive a copy, and a queue deletes each message once a consumer acknowledges it. A Kafka producer appends records to a topic split into partitions, the records stay for a retention period whether or not anyone has read them, and each consumer group keeps its own position in the log. RabbitMQ is designed to get each message to the right worker and then forget it. Kafka is designed to keep an ordered history that any number of readers can go back over.
In 2026 the line between them is less sharp than most comparisons suggest. RabbitMQ has had streams since version 3.9 in 2021: replicated logs that keep every message and let any number of consumers start reading from any point. Kafka made share groups production-ready in 4.2, in February 2026. They give Kafka queue-style consumption with an acknowledgment for each record, and 4.4 added dead-letter topics to them in October 2026. Each now has a version of the other's model, with gaps that the sections below list. Roughly, RabbitMQ fits work queues, routing, retries with back-off, priorities and scheduled delivery, and clients that speak AMQP, MQTT or STOMP. Kafka fits high-volume event streams kept for days or years, the same events read by many independent services, and stream processing with Kafka Streams, Flink or Kafka Connect. Large systems often run both, each for its own job.
Redisson, the Java client for Valkey and Redis, is our product; neither RabbitMQ nor Kafka is. Its commercial edition, Redisson PRO, can do both jobs for systems written entirely in Java, and a section near the end covers it. We checked the facts on this page on November 20, 2026, against RabbitMQ 4.4.1 (November 16, 2026) and Apache Kafka 4.4.0 (October 22, 2026). The Java samples compile against the RabbitMQ Java client 5.38.0, the RabbitMQ stream client 1.13.1, kafka-clients 4.4.0 and Redisson 4.8.0.
RabbitMQ vs Kafka at a Glance
| RabbitMQ | Apache Kafka | |
|---|---|---|
| What it is | A message broker: exchanges route messages into queues and streams. Written in Erlang, open source under the Mozilla Public License 2.0; Broadcom sells a commercial edition | A partitioned, replicated commit log. Written in Java and Scala, an Apache Software Foundation project under the Apache License 2.0; Confluent and others sell distributions and cloud services |
| Newest release | 4.4.1, November 16, 2026; free community fixes for 4.4 until July 31, 2027 | 4.4.0, October 22, 2026; the project supports the 4.4, 4.3 and 4.2 lines and aims for three releases a year |
| What happens after a read | A queue deletes the message once it is acknowledged; a stream keeps it until a size or age limit | The record stays until retention removes it, after seven days by default; compaction and tiered storage are available |
| How consumers get messages | Pushed by the broker, up to a prefetch limit; stream consumers receive chunks against credits | Pulled: consumers poll the brokers |
| Sharing work | Competing consumers on one queue, each message acknowledged on its own | Consumer groups: one consumer per partition, progress saved as offsets. Share groups (4.2 and later): any number of consumers, each record acknowledged on its own |
| Routing | Exchanges and bindings: direct, topic, fanout, headers and consistent hash | A topic, and a partition chosen by the record key; consumers filter on their side |
| Ordering | Per queue while one consumer reads it, and per stream | Per partition; share groups don't keep order |
| Retries and dead letters | On the queue: a delivery limit, 20 by default, delayed retry since 4.3, and dead-letter exchanges | Consumer groups: in application code or a framework. Share groups: a delivery limit of 5 by default and, since 4.4, a dead-letter topic that is off by default |
| Priority and scheduled delivery | 32 priority levels on quorum queues since 4.3, and delivery times set by the producer since 4.4 | Neither |
| Replay | From a stream: the first or last message, an offset or a timestamp | From any offset or timestamp still within retention |
| Protocols | AMQP 0-9-1 and 1.0, MQTT, STOMP, the stream protocol, and WebSocket | The Kafka protocol only, which Redpanda and Azure Event Hubs also accept |
| Cluster metadata | Khepri, built on Raft: the default since 4.2 and the only option since 4.3 | KRaft controllers; ZooKeeper support was removed in 4.0, in March 2025 |
| Stream processing and connectors | None built in | Kafka Streams and Kafka Connect, plus Flink, Spark and Debezium |
| Managed services | Amazon MQ on AWS, and hosting companies such as CloudAMQP | Amazon MSK, Confluent Cloud, Google Cloud Managed Service for Apache Kafka, Aiven and others |
| Java | The RabbitMQ Java client, the stream client and Spring AMQP | kafka-clients, Kafka Streams and Spring for Apache Kafka |
Queue or Log: The Difference That Still Decides Most Cases
Most practical differences between Kafka and RabbitMQ follow from what happens to a message after a consumer has processed it. In a RabbitMQ queue it is gone. In Kafka it stays where it was written until retention removes it, and the consumer group simply moves its offset past it. See our message queue and message broker entries for the general terms.
A RabbitMQ queue that fills faster than it drains is a problem to fix. Its messages wait on the broker, and when free disk space on a node falls below the configured limit, 50 MB by default, RabbitMQ raises an alarm that blocks publishers across the cluster. A Kafka consumer that falls behind is routine. Its lag grows, the records wait on disk, and nothing upstream notices unless the lag outlasts retention, at which point the oldest records are deleted whether or not the group has read them.
To deliver one event to three services, RabbitMQ binds three queues to an exchange and stores a copy in each, and each copy is acknowledged separately. Kafka stores the event once, and three consumer groups read it, each with its own offset. A fourth service added next month can read the retained history in Kafka from the beginning, while a new RabbitMQ queue receives only what arrives after it is bound, unless the events also go to a stream.
RabbitMQ also keeps state for every message: whether a consumer holds it, how many times it has failed, where it goes if it keeps failing. A Kafka consumer group keeps one committed offset per partition. That is a large part of why Kafka is cheap to read at high volume, and why a record that keeps failing has nowhere to go unless the application gives it somewhere.
Most choices come down to two questions. Will anything need a message after it has been processed, such as a new service reading history, a replay after a bug fix or an audit? Then you need a log: Kafka, or a RabbitMQ stream. Does each message need its own handling, such as routing to some consumers and not others, a retry after a delay, a priority or a dead-letter destination? Then you need a queue: RabbitMQ, or a Kafka share group for the parts it covers. If both answers are yes, the next table shows which consumption model covers which need.
Four Ways to Consume: Quorum Queues, Streams, Consumer Groups and Share Groups
Each system now offers two ways to consume, and the table below compares all four. Quorum queues are RabbitMQ's replicated queue type, production-ready since 2019 and the type to use for messages that must survive a node failure. Streams are its replicated log. Consumer groups are how Kafka has always been read, and share groups are the queue-style model that Kafka 4.2 made production-ready.
| RabbitMQ quorum queue | RabbitMQ stream | Kafka consumer group | Kafka share group | |
|---|---|---|---|---|
| Available since | 3.8 (2019) | 3.9 (2021) | The original model | Production-ready in 4.2 (2026) |
| A read removes the message | Yes, once acknowledged | No | No | No; acknowledged records stay until retention removes them |
| What the consumer acknowledges | Each message | Nothing per message; it can store an offset on the broker | An offset per partition | Each record: accept, release, reject or renew |
| Sharing the work | Any number of competing consumers | Each consumer reads everything; work is split by partitioning into a super stream | At most one consumer per partition | Any number, up to 200 members per group by default |
| Order | Queue order while one consumer reads; competing consumers and retries change it | Stream order | Partition order | Not preserved |
| Delivery count | Counted; limit 20 by default, and since 4.3 only failed deliveries count | None | None | Counted; limit 5 by default |
| Dead letters | Dead-letter exchange | None | Application code or a framework | A dead-letter topic since 4.4, off by default |
| Delay before a retry | Delayed retry since 4.3 | None | Application code, usually retry topics | None; a released record is available again at once |
| Priority | 32 levels since 4.3 | No | No | No |
| Delivery time set by the producer | Since 4.4 | No | No | No |
| Expiry | Time to live per message or per queue | Retention by age or size | Retention by time or size, or compaction | The topic's retention |
| Replay | No | From the first or last message, an offset or a timestamp | From any retained offset or timestamp | Only by resetting the group's start offset |
| Filtering on the broker | Routing decides what reaches the queue | Bloom filters, and SQL filter expressions since 4.2 | No | No |
| Clients | Any AMQP 0-9-1 or AMQP 1.0 client | Stream protocol clients, and AMQP 0-9-1 or 1.0 clients | Every Kafka client | The Java client in production; librdkafka-based clients in preview since June 2026 |
Share groups still lack several queue features. They have no priorities, no scheduled delivery and no time to live per message, and they give up ordering. A released record returns to the group immediately with no back-off, so an outage in a downstream service can use up all five delivery attempts within seconds. By default each partition lets a group hold at most 2,000 records in flight, and a share consumer can't subscribe to topics by pattern. Is Kafka a Message Queue? walks through how share groups behave in more detail.
Only Kafka's Java client supports share groups for production use. librdkafka, the C library under Confluent's Python, Go and .NET clients, added a share consumer in June 2026 that its release notes mark as a preview that "should not be used in production". Managed Kafka trails too: in mid-November 2026, Amazon MSK offered share groups only as a preview on Kafka 4.1 Standard brokers and not at all on Express brokers, as our Kinesis vs Kafka comparison details. Check every client language and your provider before planning on them.
On the RabbitMQ side, a stream gives up everything a queue tracks per message: there is no redelivery count, no dead-lettering and no priority, and over AMQP a stream consumer's acknowledgments only grant credit for more messages. A producer can avoid writing duplicates by giving itself a name and each message an increasing publishing ID, but the stream clients maintained by the RabbitMQ team leave deduplication off unless you set both.
Routing and Filtering
RabbitMQ decides on the broker where a message goes. A producer publishes to an exchange with a routing key, and bindings copy the message into every queue or stream that matches. Direct exchanges compare the routing key for equality, topic exchanges accept wildcard patterns such as invoices.*.eu, fanout exchanges send to every bound queue, and headers exchanges test message headers instead of the key. Exchanges can also be bound to other exchanges, an alternate exchange catches messages that match no binding, and the consistent hash exchange, a plugin shipped with RabbitMQ, spreads keys across a set of queues. A new consumer that wants part of the traffic needs a queue and a binding, and the producers don't change.
Kafka routes by topic and partition only. The producer picks the topic, and the record key picks the partition. A service that wants only European invoices reads the whole topic and drops the rest, or the team splits topics by region from the start, or a Kafka Streams job writes a filtered copy to a new topic. Each choice costs something: read bandwidth, a growing number of topics, or another job to run.
RabbitMQ streams can also be filtered on the broker, in two ways. Bloom filters work on whole chunks, so the broker can send messages that don't match, and the client has to check each one again; the Java stream client takes that check as a postFilter. Since 4.2, AMQP 1.0 consumers can attach SQL filter expressions instead, which the broker applies exactly. Kafka has no broker-side equivalent.
Ordering and Parallelism
A RabbitMQ queue is first in, first out, but only while one consumer reads it. With several competing consumers, messages finish in whatever order the workers do, and a retried message arrives after others published later. Single active consumer keeps the order: the queue delivers to one consumer at a time and switches to another if that one disconnects. To scale out and still keep order per key, the consistent hash exchange splits traffic by key across several queues, each with a single active consumer. Super streams do the same for streams, with single active consumer per partition since 3.11.
There is a throughput ceiling per queue as well. Each quorum queue has one leader, and all its traffic goes through that node, so a single queue can't use a whole cluster. Spreading load means more queues, and with the consistent hash exchange that is also how per-key order survives.
Kafka promises order only inside a partition. The producer's key picks the partition, so events for one customer stay in sequence, and a consumer group gives each partition to exactly one member, so a topic with 12 partitions keeps at most 12 consumers busy in one group. Choose the count with growth in mind: repartitioning remaps keys, and for a while two partitions can hold events for the same customer. A record that takes a minute to process holds back everything behind it in its partition. Share groups lift the consumer limit by letting several members take records from the same partition, and give up ordering to do it.
Push or Pull?
RabbitMQ pushes. A consumer registers with basic.consume, and the broker sends it messages as they arrive, up to the prefetch limit the consumer sets with basic.qos. The prefetch limit is what keeps a slow consumer from being flooded: the broker stops sending once that many messages are unacknowledged. A pull operation, basic.get, exists, but RabbitMQ's consumer guide strongly recommends against it outside integration tests. Stream consumers are also pushed messages, a chunk at a time, against credits they grant.
Kafka pulls. A consumer calls poll(), and the client fetches records from the partition leaders. When no data is ready, a fetch waits up to fetch.max.wait.ms, 500 ms by default, so polling an idle topic doesn't spin. Because the consumer sets the pace, a slow one falls behind instead of being flooded. It does have a deadline: a consumer that goes longer than max.poll.interval.ms, five minutes by default, between polls is removed from its group and its partitions move to another member. Share consumers poll too, and every record they receive is locked to them for 30 seconds by default; a consumer that needs longer acknowledges the record with RENEW to extend the lock.
Both models protect a slow consumer, RabbitMQ through prefetch and Kafka by letting it lag. The difference shows under sustained overload: a RabbitMQ backlog stays on the broker and eventually blocks producers, while a Kafka backlog costs disk space until retention deletes records nobody has read. Our backpressure entry covers the general patterns.
Retries, Dead Letters, Delays and Priority
RabbitMQ keeps the retry rules on the broker. Kafka left them to the application until share groups arrived.
RabbitMQ Quorum Queues
A quorum queue counts failed deliveries and acts on the count. The limit is 20 by default; a message that fails more often goes to the queue's dead-letter exchange, or is dropped if the queue has none. Since RabbitMQ 4.3 the count goes up only when a delivery fails: on basic.reject, on the AMQP 1.0 rejected or modified-as-failed outcomes, and when a consumer's connection drops. A basic.nack, a release or a consumer timeout leaves it unchanged, so a worker that answers a bad message with basic.nack and requeue gets it back forever. RabbitMQ 4.3 also added delayed retry, which sets a failed message aside for a delay that grows with each failure, up to a maximum you choose, while the rest of the queue keeps moving. Dead-lettering is at most once by default; at-least-once dead-lettering needs the at-least-once strategy together with the reject-publish overflow setting. ActiveMQ vs RabbitMQ lists these defaults side by side with ActiveMQ's.
Kafka Consumer Groups
Consumer groups have no retry state on the broker at all. Progress is a committed offset per partition, so the broker can't tell a record that failed from one that succeeded, and what happens to a failure is decided in application code. Most teams use a framework for it. Spring for Apache Kafka can retry in memory, route failures through a chain of retry topics with growing delays (@RetryableTopic), and publish what is left to a dead-letter topic, and Kafka Connect and Kafka Streams have error-handling settings of their own. Each of those means more topics and consumers to run, and a retry topic delivers the records it holds back out of order with the rest.
Kafka Share Groups
Share groups move the count to the broker. Each record has a delivery count, and the group's limit is five by default; operators can allow up to 25. A consumer that releases a record makes it available again immediately to any member, and one that rejects it ends its deliveries at once. Until Kafka 4.4, a record that was rejected or ran out of attempts was simply archived. KIP-1191 added dead-letter topics in 4.4, and switching them on takes five steps, with defaults set in the broker, topic and group configurations:
- Upgrade the cluster's
share.versionfeature to 2 withkafka-features.sh. Version 1 enables share groups without dead-letter topics. - Create the topic yourself. The broker can create it, but
errors.deadletterqueue.auto.create.topics.enableis false by default. - Start its name with
dlq., a prefix the broker requires by default througherrors.deadletterqueue.topic.name.prefix. - Set
errors.deadletterqueue.group.enableto true on that topic. It is false by default, and until it is true the broker refuses to use the topic for dead letters. - Set
errors.deadletterqueue.topic.nameon the group, and seterrors.deadletterqueue.copy.record.enableto true if you want the failed record itself. By default the broker writes only a record of headers that describe the failure.
The dead letter queue guide covers what to do with messages once they land, on both brokers.
Priority and Scheduled Delivery
Kafka has neither. Records are delivered in log order whatever their importance, and a producer can't publish a record for later; teams build delays with a scheduler, or with a holding topic whose consumer forwards records when they are due. On RabbitMQ, quorum queues have delivered 32 priority levels in strict order since 4.3, and classic queues support up to 255 levels when declared with x-max-priority. Since 4.4 a producer can name a delivery time, as a millisecond timestamp in the x-opt-delivery-time header (a message annotation over AMQP 1.0), and the quorum queue keeps the message until then, with no plugin involved.
Retention, Replay and Compaction
A Kafka topic keeps records for seven days unless configured otherwise, through retention.ms on the topic or a size limit, and it can keep them forever. Tiered storage, production-ready since Kafka 3.9, moves older segments to object storage so a long history doesn't have to sit on broker disks, though Apache Kafka ships no storage plugin of its own: you add one, or use a distribution that includes one. Log compaction keeps only the latest record for each key, which is how Kafka holds changelogs and the current state of every entity indefinitely. A consumer group replays by resetting its offsets to the beginning, to an offset or to a point in time, with kafka-consumer-groups.sh --reset-offsets while the group is stopped, or in code with offsetsForTimes() and seek(). Amazon Kinesis vs Kafka shows the command.
RabbitMQ streams replay the same way, by offset or timestamp, with three differences. A stream has no retention limit unless you set one, and RabbitMQ's streams guide says such a log grows until the disk runs out. Retention is applied to whole segment files, 500 MB by default, so a stream holds somewhat more than its limit. And there is no compaction. A consumer with a name can store its offset on the broker and resume from it, while a consumer without one starts wherever its offset specification points, which by default is the next message to arrive. The sample creates a stream with a seven-day, 50 GB limit and rebuilds a read model from the last six hours:
import com.rabbitmq.stream.ByteCapacity;
import com.rabbitmq.stream.Consumer;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
import java.time.Duration;
import java.time.Instant;
Environment env = Environment.builder()
.uri("rabbitmq-stream://reader:" + password + "@rabbit-1:5552/%2f")
.build();
// Without a limit the stream grows until the disk runs out. Retention
// removes whole segment files, so expect to keep a little more than this
env.streamCreator().stream("invoice-events")
.maxAge(Duration.ofDays(7))
.maxLengthBytes(ByteCapacity.GB(50))
.create();
// Rebuild a read model from the last six hours. The consumer has no name,
// so the broker stores no offset for it: right for a one-off replay
long from = Instant.now().minus(Duration.ofHours(6)).toEpochMilli();
Consumer replay = env.consumerBuilder()
.stream("invoice-events")
.offset(OffsetSpecification.timestamp(from))
.messageHandler((context, message) ->
rebuildView(context.offset(), message.getBodyAsBinary()))
.build();
The queue-style models replay little or nothing. A quorum queue deletes acknowledged messages. A share consumer has no seek(); an administrator can move the group's start offset back with kafka-share-groups.sh while the group is stopped, and the whole group then receives those records again. Teams that need both per-message handling and replay on RabbitMQ bind a stream next to the queue, so one exchange feeds both.
Durability and Delivery Guarantees
A quorum queue confirms a published message only after a majority of its replicas, three by default, have written it to disk, and a shared write-ahead log lets one disk sync cover many queues. With publisher confirms on the producer side and manual acknowledgments on the consumer side, delivery is at least once: the broker redelivers anything a crashed consumer didn't acknowledge, so consumers have to expect duplicates. Streams are replicated as well, but they confirm writes without syncing them to disk first, the same trade Kafka makes.
Kafka's durability comes from replication. By default the broker leaves flushing to the operating system, and with acks=all, the producer default since Kafka 3.0, a write succeeds once every in-sync replica has it. Two broker defaults weaken that. A topic created automatically on first use, which auto.create.topics.enable allows by default, gets one partition and one replica, because num.partitions and default.replication.factor both default to 1. And min.insync.replicas defaults to 1, so acks=all can succeed with a single copy. Production clusters usually set a replication factor of 3 and min.insync.replicas of 2, and many turn automatic topic creation off.
Kafka goes further than RabbitMQ on exactly-once, inside its own boundary. Producers are idempotent by default, so a retried send doesn't write a duplicate, and transactions let an application read from one topic, write to another and commit its consumer offsets in one atomic step; Kafka Streams' exactly-once mode is built on that. Share-group acknowledgments can't be part of a transaction yet, a gap that KIP-1289 proposes to close. RabbitMQ has nothing comparable for queues, while streams can discard duplicate publishes. Neither broker can make an effect outside itself happen exactly once: a consumer that charges a card has to be an idempotent consumer, and keeping a database and a topic in step takes the outbox pattern.
Kafka vs RabbitMQ Performance: Which Is Faster?
Kafka sustains more throughput, and RabbitMQ can deliver an individual message with lower latency at moderate load. Published tests agree on that much, but the figures most comparison pages repeat come from a setup RabbitMQ 4 can't reproduce. In a benchmark published in August 2020 by Confluent, which sells Kafka, Kafka 2.6, RabbitMQ 3.8.5 and Pulsar 2.6 ran on three brokers with three-way replication and 1 KB messages. Kafka peaked at 605 MB/s, Pulsar at 305 MB/s and RabbitMQ at 38 MB/s, and RabbitMQ's p99 latency was about 1 ms at a reduced load of 30 MB/s, degrading sharply above it. The RabbitMQ side used classic mirrored queues, which RabbitMQ 4.0 removed, and the test covered neither quorum queues nor streams.
RabbitMQ's own comparison page, written by the RabbitMQ team, reports about 80,000 messages a second for a quorum queue that replicates and syncs to disk, about 100,000 for a classic queue, and reads of several million a second from a single stream whose chunks are well filled. With sub-entry batching, RabbitMQ measured more than 4 million messages a second end to end on one stream and more than 17 million across five. We found no independent benchmark of RabbitMQ 4 against Kafka 4.
Settings move these numbers a long way. The same RabbitMQ page reports a 20-fold difference in throughput between well-batched and poorly batched streams, and Kafka's producer waits up to linger.ms, 5 ms by default, to fill a batch. Message size, whether every write is synced to disk, the replication factor, acknowledgment settings, prefetch, and how many queues or partitions share the load all count too. A single quorum queue runs on one leader node, while a topic with many partitions spreads across the cluster. If throughput decides your choice, run the OpenMessaging Benchmark, which has drivers for both, with your own message sizes and durability settings on the versions you would deploy.
Protocols, Clients and Ecosystem
RabbitMQ speaks open protocols. AMQP 0-9-1 is its original protocol, AMQP 1.0 has been native since 4.0, and MQTT 3.1, 3.1.1 and 5.0, STOMP and WebSocket support ship with the server, as does the binary protocol that stream clients use. That makes RabbitMQ a natural hub for mixed estates: devices over MQTT, a Python service over AMQP, and Java services over JMS through the RabbitMQ JMS client, which has gaps in its open-source edition.
Kafka speaks only its own protocol, which other products now implement: Redpanda, Azure Event Hubs and several others accept Kafka clients. Its ecosystem is the strongest argument for it. Kafka Connect moves data between Kafka and databases, object stores and SaaS applications; Debezium, built on Connect, streams changes out of databases; Kafka Streams and Apache Flink process streams with state and exactly-once guarantees; and schema registries manage record formats. RabbitMQ has nothing comparable for stream processing, and its Shovel and Federation plugins move messages between brokers rather than between systems.
Java is well served on both sides. RabbitMQ has its AMQP client, a stream client and Spring AMQP. Kafka has kafka-clients, Kafka Streams and Spring for Apache Kafka, which has supported share consumers since 4.0 and for production use since 4.1. Spring Cloud Stream has binders for both, so a Spring service can switch brokers by changing its binder, within what each broker can do.
Operations and Managed Services
RabbitMQ runs on the Erlang virtual machine. Its metadata store is Khepri, built on Raft, the default for new clusters since 4.2 and the only option since 4.3, which removed Mnesia. Quorum queues and streams need at least three nodes to survive the loss of one. The broker protects itself with memory and disk alarms that block publishers, so watching queue depth and consumer health matters as much as raw capacity. It ships a management UI and HTTP API, built-in Prometheus metrics, and an open-source Kubernetes Cluster Operator, and it runs on Windows as well as Linux. Each release series gets free community fixes for a limited time, until July 31, 2027 for 4.4; after that, fixes come with Broadcom's commercial support.
Kafka runs on the JVM, and since 4.0 it needs no ZooKeeper: KRaft controllers, either dedicated or running alongside brokers, hold the cluster metadata. Capacity planning centers on partitions, meaning how many, where their replicas sit, and how to move them when brokers are added, which Apache Kafka does with kafka-reassign-partitions.sh and many teams automate with Cruise Control. Metrics come out through JMX and need an exporter for Prometheus. Strimzi, a CNCF project, is the usual Kubernetes operator. Kafka's documentation says that "Windows is not currently a well supported platform". The project aims for three releases a year and supports the three most recent release lines.
If you would rather run neither, Kafka is offered as Amazon MSK, Confluent Cloud, Google Cloud Managed Service for Apache Kafka and by Aiven and others, and Azure Event Hubs accepts Kafka clients. RabbitMQ is offered as Amazon MQ on AWS and by hosting companies such as CloudAMQP; Google Cloud and Azure have no managed RabbitMQ of their own. Managed services trail the open-source releases and leave features out. Amazon MQ runs RabbitMQ 4.3 without streams, as Amazon MQ vs RabbitMQ explains, and Amazon MSK's share groups were still a preview in November 2026. Google Pub/Sub vs Kafka covers Google's managed Kafka.
One Job on Both: A Retrying Work Queue in Java
Here is one job written for each broker. Workers render invoices from a queue, a malformed invoice goes straight to a dead-letter destination, and any other failure is retried a limited number of times. The first sample uses a RabbitMQ 4.4 quorum queue and the RabbitMQ Java client 5.38.0:
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.DeliverCallback;
import java.util.Map;
ConnectionFactory factory = new ConnectionFactory();
factory.setUri(System.getenv("RABBITMQ_URI"));
Channel channel = factory.newConnection("invoice-workers").createChannel();
channel.exchangeDeclare("invoices.dlx", BuiltinExchangeType.FANOUT, true);
channel.queueDeclare("invoices.dead", true, false, false, null);
channel.queueBind("invoices.dead", "invoices.dlx", "");
// The retry policy lives on the queue: a failed delivery comes back after
// 2 s, then 4, 6 and 8 s (delayed retry, RabbitMQ 4.3), and the fifth
// failure goes to the dead-letter exchange instead
channel.queueDeclare("invoices", true, false, false, Map.of(
"x-queue-type", "quorum",
"x-delivery-limit", 4,
"x-delayed-retry-type", "failed",
"x-delayed-retry-min", 2_000,
"x-delayed-retry-max", 60_000,
"x-dead-letter-exchange", "invoices.dlx"));
// The broker pushes; prefetch caps the unacknowledged messages it holds
channel.basicQos(20);
DeliverCallback onDelivery = (consumerTag, delivery) -> {
long tag = delivery.getEnvelope().getDeliveryTag();
try {
render(delivery.getBody());
channel.basicAck(tag, false);
} catch (MalformedInvoiceException e) {
// Retrying can't fix it: dead-letter it now
channel.basicReject(tag, false);
} catch (RuntimeException e) {
// Counts toward the delivery limit; basicNack wouldn't, since 4.3
channel.basicReject(tag, true);
}
};
channel.basicConsume("invoices", false, onDelivery, consumerTag -> { });
On Kafka 4.4 the same job needs a share group, because a consumer group can't retry or dead-letter a single record. The setup at the top runs once, through the Admin API in kafka-clients 4.4.0:
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AlterConfigOp;
import org.apache.kafka.clients.admin.ConfigEntry;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.AcknowledgeType;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.KafkaShareConsumer;
import org.apache.kafka.common.config.ConfigResource;
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.StringDeserializer;
// Once per cluster: kafka-features.sh ... upgrade --feature share.version=2
// (version 1 enables share groups, version 2 adds their dead-letter topics)
try (Admin admin = Admin.create(Map.of("bootstrap.servers", brokers))) {
// Kafka doesn't create the DLQ topic by default. Its name must start
// with "dlq.", and the topic must opt in to taking a group's records
NewTopic dlq = new NewTopic("dlq.invoices", 3, (short) 3)
.configs(Map.of("errors.deadletterqueue.group.enable", "true"));
admin.createTopics(List.of(dlq)).all().get();
ConfigResource group =
new ConfigResource(ConfigResource.Type.GROUP, "invoice-workers");
AlterConfigOp.OpType set = AlterConfigOp.OpType.SET;
admin.incrementalAlterConfigs(Map.of(group, List.of(
new AlterConfigOp(new ConfigEntry(
"share.delivery.count.limit", "5"), set),
new AlterConfigOp(new ConfigEntry(
"errors.deadletterqueue.topic.name", "dlq.invoices"), set),
// Off by default: the DLQ record then carries headers that
// describe the failure, but not the original key and value
new AlterConfigOp(new ConfigEntry(
"errors.deadletterqueue.copy.record.enable", "true"),
set))))
.all().get();
}
Properties props = new Properties();
props.put("bootstrap.servers", brokers);
props.put("group.id", "invoice-workers");
props.put("key.deserializer", StringDeserializer.class.getName());
props.put("value.deserializer", ByteArrayDeserializer.class.getName());
// Every record from poll() must be acknowledged before the next poll()
props.put("share.acknowledgement.mode", "explicit");
try (KafkaShareConsumer<String, byte[]> consumer =
new KafkaShareConsumer<>(props)) {
consumer.subscribe(List.of("invoices"));
while (running) {
for (ConsumerRecord<String, byte[]> record
: consumer.poll(Duration.ofSeconds(1))) {
try {
render(record.value());
consumer.acknowledge(record, AcknowledgeType.ACCEPT);
} catch (MalformedInvoiceException e) {
// Never delivered again; the broker copies it to the DLQ
consumer.acknowledge(record, AcknowledgeType.REJECT);
} catch (RuntimeException e) {
// Available again at once, to any consumer in the group.
// There is no delay; the fifth delivery is the last
consumer.acknowledge(record, AcknowledgeType.RELEASE);
}
}
// acknowledge() only records the outcome locally; this sends it
consumer.commitSync();
}
}
Three differences show in the code. RabbitMQ waits before each retry and Kafka doesn't. RabbitMQ's dead-letter destination is a queue that any AMQP client can read, while Kafka's is a topic whose records describe the failure in headers. And the RabbitMQ worker receives messages in a callback, while the Kafka worker loops over poll() and must answer for every record before polling again.
Running Both, or Moving Between Them
Many teams run both brokers and split the work. RabbitMQ carries commands and jobs, where one service asks another to do something and needs routing and retries. Kafka carries events that several services and analytics pipelines read, and sometimes replay. To pass messages between the two, Confluent offers RabbitMQ source and sink connectors for Kafka Connect, which are commercial: free for a 30-day trial, then under a Confluent enterprise license. In Java, a small Spring Cloud Stream application with a binder for each broker can read from one and write to the other, and a service that has to publish the same event to both is safer writing it once to an outbox table and letting a relay publish it.
Moving from RabbitMQ to Kafka changes application code: exchanges and bindings become topics and keys, filtering moves into the consumers, priorities and scheduled delivery disappear, a time to live per message becomes topic retention, and dead-lettering becomes a share-group setting or a framework feature. Moving the other way gives up Kafka's ecosystem: Kafka Streams applications and Connect pipelines have no RabbitMQ counterpart, and consumers that replay history need streams rather than queues. In either direction, a bridge that copies messages from the old system to the new lets consumers move first and producers after them.
Where Redis Fits
Teams that already run Redis or Valkey often ask whether it could carry their messages instead of RabbitMQ or Kafka. Redis Pub/Sub can't replace either broker: it delivers to whoever is connected at that moment and keeps nothing. Redis Streams can do part of the job. A stream is a log with consumer groups, and a consumer group tracks each delivered entry until it is acknowledged, which puts it between a Kafka partition and a RabbitMQ queue. Redis vs Kafka, Redis vs RabbitMQ and Redis Streams vs Kafka cover the trade-offs.
When Every Service Is Java: Reliable Queue and PubSub
Some teams asking "RabbitMQ or Kafka?" would rather operate neither. All their services are Java, and Valkey or Redis already runs next to them for caching or sessions. Redisson PRO builds queues and topics on that store. Reliable Queue handles work queues, and Reliable PubSub handles topics whose subscriptions can be rewound, so one structure has a queue's per-message acknowledgment and a log's replay. Redisson PRO also ships a JMS provider and a Spring Cloud Stream binder built on them. The features compared above map like this:
| Need | RabbitMQ | Kafka | Redisson PRO Reliable PubSub |
|---|---|---|---|
| Workers share the load, acknowledging messages one by one | Competing consumers on a queue | A share group | Several consumers on one subscription |
| Each service gets every message | A queue per service, bound to an exchange | A consumer group per service | A subscription per service |
| Retry limit and dead letters | Delivery limit and a dead-letter exchange | Delivery count limit and a dead-letter topic, share groups on 4.4 | deliveryLimit and deadLetterTopicName on the subscription |
| A delay before the retry | Delayed retry, 4.3 | None | A negative acknowledgment with a delay |
| Priority | 32 levels on quorum queues, 4.3 | None | 0 to 9 |
| Delivery time set by the producer | x-opt-delivery-time, 4.4 | None | A delay on each message |
| Replay | A stream, by offset or timestamp | An offset reset | seek() to a time, a message ID, the start or the end |
| Retention | A stream's age and size limits | Topic retention or compaction, on disk | timeToLive and maxSize per topic, in memory |
| Clients | AMQP, MQTT, STOMP and stream clients | Kafka clients | Redisson's Java API and its JMS provider |
The sample publishes an invoice with a priority and a ten-minute delay, processes it on a subscription with a delivery limit and a dead-letter topic, and rewinds the subscription by six hours. In it, redisson is an existing RedissonClient and Invoice is your own message type:
import java.time.Duration;
import java.time.Instant;
import org.redisson.api.Message;
import org.redisson.api.MessageArgs;
import org.redisson.api.RReliablePubSubTopic;
import org.redisson.api.SyncFailureMode;
import org.redisson.api.SyncMode;
import org.redisson.api.pubsub.ConsumerConfig;
import org.redisson.api.pubsub.MessageAckArgs;
import org.redisson.api.pubsub.MessageNegativeAckArgs;
import org.redisson.api.pubsub.Position;
import org.redisson.api.pubsub.PublishArgs;
import org.redisson.api.pubsub.PullArgs;
import org.redisson.api.pubsub.PullConsumer;
import org.redisson.api.pubsub.Subscription;
import org.redisson.api.pubsub.SubscriptionConfig;
import org.redisson.api.pubsub.TopicConfig;
RReliablePubSubTopic<Invoice> invoices =
redisson.getReliablePubSubTopic("invoices");
// Keep a week of history, as a log would. By default the topic keeps every
// message indefinitely, and all of it sits in Valkey's or Redis's memory
invoices.setConfigIfAbsent(TopicConfig.defaults()
.timeToLive(Duration.ofDays(7))
.maxSize(5_000_000));
// One subscription per service, like a Kafka consumer group; the consumers
// inside it compete for messages, like workers on a RabbitMQ queue.
// Created once, when the billing service is first deployed
Subscription<Invoice> billing = invoices.createSubscription(
SubscriptionConfig.name("billing")
.deliveryLimit(5)
.deadLetterTopicName("invoices-billing-dead"));
// Priority and a delay set by the producer, which Kafka has neither of.
// Wait for a replica, and fail the call rather than log a warning
invoices.publish(PublishArgs.messages(MessageArgs.payload(invoice)
.priority(9)
.delay(Duration.ofMinutes(10)))
.syncMode(SyncMode.ACK)
.syncFailureMode(SyncFailureMode.THROW_EXCEPTION));
PullConsumer<Invoice> worker =
billing.createPullConsumer(ConsumerConfig.name("billing-1"));
for (Message<Invoice> msg : worker.pullMany(PullArgs.defaults()
.count(10)
.timeout(Duration.ofSeconds(30)))) {
try {
charge(msg.getPayload());
worker.acknowledge(MessageAckArgs.ids(msg.getId()));
} catch (RuntimeException e) {
// Back in 30 seconds; every delivery counts toward the limit
worker.negativeAcknowledge(MessageNegativeAckArgs
.failed(msg.getId())
.delay(Duration.ofSeconds(30)));
}
}
// Replay: move the subscription back six hours, like an offset reset
billing.seek(Position.timestamp(Instant.now().minus(Duration.ofHours(6))));
Use Cases: How to Choose Between RabbitMQ and Kafka
The rows are ordered by how strongly they decide the choice. Stop at the first one that is true for you, then skim the rest, since a later row can add a second system.
| If this is true | Choose |
|---|---|
| Clients connect over MQTT, STOMP or AMQP, or services in several languages all need per-message control | RabbitMQ |
| Messages need routing by pattern or header, priorities, delivery times set by the producer, or retries with back-off | RabbitMQ with quorum queues |
| You need weeks to years of history, the latest state per key through compaction, or Kafka Streams, Flink or Connect | Kafka |
| Several services read the same events independently, or new services must read history | Kafka; or RabbitMQ streams if you already run RabbitMQ and the volume is moderate |
| You already run Kafka well and need a work queue for Java consumers, without priorities or delays | Kafka share groups (4.2 and later), with a dead-letter topic (4.4 and later), if your provider supports them |
| You already run RabbitMQ and a few consumers need replay | A RabbitMQ stream with retention limits, bound next to the queues |
| Every service is in Java, Valkey or Redis is already deployed, and the backlog and history fit in memory | Redisson PRO's Reliable Queue and Reliable PubSub |
RabbitMQ vs Kafka: Frequently Asked Questions
Is RabbitMQ a Push or Pull Model?
Push. Consumers subscribe with basic.consume, and RabbitMQ sends them messages as they arrive, up to the prefetch limit each consumer sets with basic.qos, so a slow consumer never holds more unacknowledged messages than it asked for. A pull operation, basic.get, also exists, but RabbitMQ's documentation strongly recommends against it outside integration tests. Stream consumers are pushed messages too, a chunk at a time, against credits they grant.
Is Kafka Push or Pull?
Pull. Kafka consumers call poll(), and the client fetches records from the partition leaders, waiting up to fetch.max.wait.ms, 500 ms by default, when no data is ready. Pulling lets each consumer read at its own pace: a slow consumer falls behind without slowing the others, and its unread records wait on disk until retention removes them. Share consumers pull too, and the broker locks each record they receive for 30 seconds by default.
Is RabbitMQ Faster Than Kafka?
For a single message at moderate load, RabbitMQ can be quicker: Confluent's 2020 benchmark measured a p99 latency of about 1 ms for RabbitMQ at 30 MB/s. For throughput Kafka wins, peaking at 605 MB/s against 38 MB/s for RabbitMQ in the same test. That test used RabbitMQ 3.8 mirrored queues, which no longer exist, and no streams, for which RabbitMQ reports millions of messages a second. Measure your own workload on current versions before choosing on speed.
When Would You Choose Kafka Over RabbitMQ?
When the data is still useful after it has been processed. Kafka fits when many independent services read the same events, new consumers need history, records must be kept for weeks or years or compacted by key, throughput reaches hundreds of megabytes a second, or the pipeline depends on Kafka Connect, Kafka Streams or Flink. If the main job is handing out tasks with retries, routing, priorities or delays, RabbitMQ fits better, although Kafka share groups now cover simple work queues for Java consumers.
Can RabbitMQ Streams Replace Kafka?
For moderate event streaming, often yes. Streams are replicated append-only logs that consumers read from an offset or a timestamp, super streams partition them, and RabbitMQ reports millions of messages a second for a single stream. They lack Kafka's ecosystem of connectors and stream processors, as well as log compaction and tiered storage, and their retention is unlimited until you set an age or size limit. A team that already runs RabbitMQ can start with streams before adding a second system.
Can RabbitMQ and Kafka Be Used Together?
Yes, and large systems often use both: RabbitMQ for commands and jobs that need routing and retries, Kafka for events that many consumers read and replay. To move messages between them, use Kafka Connect connectors, such as Confluent's RabbitMQ source and sink connectors, which need a commercial license after a 30-day trial; a Spring Cloud Stream application with a binder for each broker; or an outbox relay that publishes the same event to both.
Is RabbitMQ Easier to Run Than Kafka?
Usually, at small and medium scale. A three-node RabbitMQ cluster with quorum queues has fewer decisions to make up front than a Kafka cluster, whose partition counts, replica placement and rebalancing need attention from the start, and RabbitMQ ships a management UI and Prometheus metrics. At large scale both need specialists, and since Kafka 4.0 removed ZooKeeper the gap is smaller than older comparisons suggest. Managed services exist for both: Amazon MSK and Confluent Cloud for Kafka, Amazon MQ and CloudAMQP for RabbitMQ.
Similar articles
- Apache Kafka Alternatives: 7 Options Compared
- RabbitMQ Alternatives: Seven Options, and What Each One Breaks
- ActiveMQ vs RabbitMQ: Key Differences, JMS Support and How to Choose
- Amazon MQ vs RabbitMQ: Managed vs Self-Hosted, Limits and Costs
- Amazon Kinesis vs Kafka: Key Differences, Costs and How to Choose
- Google Pub/Sub vs Kafka: Key Differences, Costs and How to Choose
- IBM MQ vs Kafka: When Kafka Replaces a Queue, and When It Cannot
- Redis vs. Kafka: When to Use Each
- Apache Kafka vs Valkey & Redis Based Reliable PubSub