Independent ActiveMQ handbook · archive of the 2004–2007 project site
Independent guide. Not the Apache ActiveMQ project site and not affiliated with the Apache Software Foundation. ActiveMQ and Apache are trademarks of the ASF. Official documentation: activemq.apache.org.

activemq.org › Handbook › ActiveMQ vs Kafka: differences and when to use each

Handbook

ActiveMQ vs Kafka: differences and when to use each

Checked against ActiveMQ Classic 6.4.0, 6.3.3 and 5.19.12 and Apache Artemis 2.57.0 on . Independent guide; sources are listed at the end. Official documentation: activemq.apache.org and artemis.apache.org.

ActiveMQ is a JMS message broker: it holds messages in queues and topics, pushes them to consumers, and a queued message is gone once a consumer has acknowledged it. Apache Kafka is an event streaming platform: it appends records to partitioned, replicated topics that consumers pull by offset and can re-read until the topic's retention period removes them.

So the choice is less "which is faster" than "do you need a broker that hands out work and routes messages, or a durable log of events that many readers replay?" This page compares both ActiveMQ brokers, ActiveMQ Classic (6.4.0, 27 October 2026) and Apache Artemis (formerly ActiveMQ Artemis; 2.57.0, 9 September 2026), with Apache Kafka 4.4 (4.4.0, 22 October 2026). Artemis has been a separate Apache top-level project since 19 November 2025; ActiveMQ Classic vs Artemis explains the split.

ActiveMQ vs Kafka at a glance

ActiveMQ ClassicApache ArtemisApache Kafka
CategoryMessage brokerMessage brokerEvent streaming platform
Main APIJMS 1.1 (full); JMS 2.0 and Jakarta Messaging 3.1 (partial)JMS 1.1, 2.0 and Jakarta Messaging 3.1 (full)Kafka's own Producer, Consumer, Admin, Streams and Connect APIs
Wire protocolsOpenWire, AMQP 1.0, STOMP, MQTTCore, AMQP 1.0, MQTT 3.1.1 and 5, STOMP, OpenWireKafka binary protocol over TCP
Delivery to consumersPush, bounded by a prefetch limitPush, bounded by a consumer windowConsumer pulls from an offset
After consumptionQueue message removedQueue message removedRecord kept until retention or compaction
ReplayLimited (retroactive consumers on topics)Limited (retroactive addresses)Rewind the offset
OrderingPer queue; message groups and exclusive consumersPer queue; message grouping and exclusive queuesPer partition, by key
FilteringJMS selectors (SQL-92)Filter expressions (SQL-92 subset)Consumers subscribe to whole topics
High availabilityShared storage master/slaveShared store or replicationPartition replication, per-topic factor
Scaling outNetworks of brokersClusters with load balancingMore partitions and brokers
Java6.4.x: 17 to 2517 or later17, 21 and 25 fully supported
LicenseApache 2.0Apache 2.0Apache 2.0

Delivery model: push with prefetch vs pull by offset

ActiveMQ Classic uses a push model: the broker dispatches messages to consumers so that each one has a local buffer ready, and a prefetch limit caps how many messages can be sent to a single consumer at once. Artemis works the same way for Core clients, which pre-fetch into a per-consumer buffer whose size is set by consumerWindowSize (1 MiB by default).

Kafka turns this around. Producers push records to brokers, and consumers pull from the broker starting at an offset they choose, with long polling so an idle consumer is not busy-waiting. Kafka's design documentation contrasts this with "most messaging systems", which keep per-message state on the broker; in Kafka a consumer group's progress is a single offset per partition, which makes acknowledgement cheap and lets a consumer deliberately rewind.

Retention and replay

In ActiveMQ, a queue gives each message to exactly one consumer, and once it is acknowledged it is removed (the Artemis documentation describes this as the normal behavior). A topic delivers a copy to every subscriber that was subscribed when the message arrived. Replay features exist but are narrow: Classic's retroactive consumers and subscription recovery policy resend recent topic messages from a timed or fixed-size buffer, and Artemis's retroactive addresses keep a fixed number of messages for queues created later.

Kafka keeps records regardless of consumption. Events in a topic can be read as often as needed, and a per-topic setting controls how long they are kept; log compaction is an alternative that keeps at least the latest record for each key. New consumer groups can start from the beginning of a topic, and an existing consumer can re-read after a bug fix.

Message ordering

An ActiveMQ queue dispatches messages in order, but with several consumers on one queue the messages are processed concurrently and processing order is lost. To keep related messages in order, Classic offers exclusive consumers and message groups: messages that share the JMSXGroupID header go to the same consumer while other groups are spread across consumers. Artemis offers message grouping on the same header, plus exclusive queues. For topics, Classic guarantees the order of messages from the same producer and has an optional total-ordering mode.

Kafka guarantees order within a partition. Records with the same key go to the same partition, so choosing the key (for example a customer ID) is how you keep related events ordered while spreading load across partitions and consumers.

Protocols, APIs and clients

ActiveMQ's main API is JMS. Classic has partial Jakarta Messaging 3.1 and JMS 2.0 support and full JMS 1.1 support; Artemis supports all three in full. Beyond Java, both brokers accept AMQP 1.0, STOMP and MQTT, and both projects list clients in JavaScript, C, C++, Python and .NET. Classic also has its native OpenWire protocol, used by the Java client and the C++ (CMS) and .NET (NMS) clients, and Artemis accepts OpenWire clients from ActiveMQ 5.12.x onward next to its own Core protocol. See STOMP and OpenWire and AMQP.

Kafka uses its own binary protocol over TCP and its own APIs. Kafka ships some clients, including its Java and Scala APIs, and the community provides dozens more for Go, Python, C/C++ and other languages, plus REST APIs. Moving an application between ActiveMQ and Kafka therefore means changing its messaging code, not just a connection URL.

Transactions and delivery guarantees

Both ActiveMQ brokers support local JMS transactions and XA, so message sends and acknowledgements can join a distributed transaction with a database through JTA (see XA transactions). Failed deliveries are retried according to a redelivery policy; in Classic, a message that exceeds maximumRedeliveries (6 by default) is treated as a poison message and can go to a dead letter queue (see dead letter queues).

Kafka's design documentation discusses at-most-once, at-least-once and exactly-once semantics, and Kafka guarantees at-least-once delivery by default. Exactly-once delivery is available in Kafka Streams and, more generally, by combining the transactional producer with consumers that use the read-committed isolation level, for workflows that read from and write to Kafka topics. Exactly-once delivery to other systems needs cooperation from those systems.

Clustering and high availability

ActiveMQ Classic provides high availability through shared storage: a master and its slaves share a file system (such as a SAN) or a JDBC database, and a slave takes over when the master fails. For scale, a network of brokers distributes queues and topics across brokers so clients can connect to any of them.

Apache Artemis supports shared-store and replication HA policies, clusters that load-balance messages across brokers according to where consumers are, message redistribution between nodes, and asynchronous mirroring for disaster recovery.

Apache Kafka replicates every partition across a configurable number of brokers, set per topic, with automatic failover to a replica when a broker fails; a replication factor of 3 is a common production setting. Cluster metadata is held by Kafka's KRaft controllers. Kafka 4.0 removed ZooKeeper mode, so clusters still on ZooKeeper must migrate through the Kafka 3.9 bridge release before upgrading.

Queue semantics in Kafka: share groups

Kafka's consumer groups assign each partition to one consumer in the group and track progress as one offset per partition. Share groups (KIP-932, "Queues for Kafka") were added for traditional messaging workloads and became production-ready in Kafka 4.2. Consumers in a share group can share partitions, can outnumber them, acknowledge records individually, and have delivery attempts counted; each fetched record is locked to one consumer for 30 seconds by default. Kafka 4.4's upgrade notes add dead-letter queue support for share groups.

That narrows the gap with an ActiveMQ queue, but share consumers still read records from ordinary topics, and Kafka's upgrade notes recommend share groups when records are processed one at a time rather than as an ordered stream.

Integration and processing

ActiveMQ Classic can run Apache Camel routes directly on the broker to apply enterprise integration patterns, and both ActiveMQ brokers can schedule delayed delivery (Classic through its optional persistent scheduler, available since 5.4; Artemis through scheduled messages). Kafka includes Kafka Connect, for import and export connectors to databases and other systems, and the Kafka Streams API, for stream processing with aggregations, joins and windowing.

Operations and management

ActiveMQ Classic includes a web console at http://localhost:8161/admin (secured since 5.8; the default login is admin/admin, which you should change) and exposes its internals through JMX; see the ActiveMQ web console and ActiveMQ monitoring. Artemis ships a Hawtio-based management console that talks to the broker through Jolokia. Kafka provides command-line tools and an Admin API, and its brokers and Java clients expose metrics through JMX. All three are Apache Software Foundation projects under the Apache License 2.0; the official documentation is at activemq.apache.org, artemis.apache.org and kafka.apache.org.

Which one should you use?

  • Java applications built on JMS or Jakarta Messaging, request/reply, or XA transactions with a database: an ActiveMQ broker. Choose Artemis for full JMS 2.0 and Jakarta Messaging 3.1 support or replication-based HA; Classic if your estate already runs it.
  • Task queues where each message is a unit of work, with selectors, redelivery policies and dead letter queues: ActiveMQ. If Kafka is already your platform, share groups (4.2 and later) cover the basic pattern.
  • Event streams that several teams consume independently, with replay, long retention or rebuilding state from history: Kafka.
  • Stream processing and moving data between databases and other systems: Kafka Streams and Kafka Connect.
  • IoT devices, browsers and non-Java clients over MQTT, STOMP or AMQP 1.0: ActiveMQ speaks these directly; Kafka clients use the Kafka protocol.
  • Strict per-entity ordering with parallel consumers: Kafka partitions keyed by entity, or ActiveMQ message groups on JMSXGroupID.

Plenty of systems use a broker and Kafka side by side, each for the part it fits. For the general picture, see what a message broker is, and for the other popular pairing, RabbitMQ vs Kafka.

Frequently asked questions

What is the difference between ActiveMQ and Kafka?

ActiveMQ is a JMS message broker that pushes messages from queues and topics to consumers and removes a queued message once it is acknowledged. Kafka is an event streaming platform that stores records in partitioned, replicated topics that consumers pull by offset and can re-read until retention removes them.

Can Kafka replace ActiveMQ?

Sometimes. Kafka 4.2 and later offer share groups for queue-style consumption with per-record acknowledgement, but applications written against JMS or Jakarta Messaging, or that rely on selectors or XA transactions, are built for a broker such as ActiveMQ and would need their messaging code changed.

Does Kafka support JMS?

Kafka has its own Producer, Consumer, Admin, Streams and Connect APIs and its own binary protocol over TCP. JMS and Jakarta Messaging are the native APIs of ActiveMQ Classic and Apache Artemis.

Is ActiveMQ or Kafka better for message ordering?

Both can keep related messages in order. Kafka orders records within a partition and sends records with the same key to the same partition; ActiveMQ uses message groups on the JMSXGroupID header or exclusive consumers to keep a group on one consumer.

Are ActiveMQ and Kafka both open source?

Yes. ActiveMQ Classic, Apache Artemis and Apache Kafka are all Apache Software Foundation projects licensed under the Apache License 2.0.

Related guides

From the 2006 archive

The original ActiveMQ documentation on these topics, kept as it was published here in 2004–2007. It describes ActiveMQ 4.x and older.

Sources

  1. Apache Kafka: Introduction kafka.apache.org
  2. Apache Kafka 4.4: Design kafka.apache.org
  3. Apache Kafka 4.4: Upgrading (notable changes) kafka.apache.org
  4. Apache ActiveMQ: home page activemq.apache.org
  5. ActiveMQ Classic: What is the prefetch limit for? activemq.apache.org
  6. ActiveMQ Classic: Message Groups activemq.apache.org
  7. Apache Artemis: home page artemis.apache.org
  8. Apache Artemis: Messaging Concepts artemis.apache.org