Book a consultation

Event-Driven Architecture

Kafka vs MQTT: Device Protocol or Streaming Log, and Why Plants Use Both

Kafka vs MQTT for manufacturing: a lightweight device protocol against a replayable streaming log, where each belongs, and the pattern that uses both.

Vladimir Romanov


Kafka vs MQTT is one of the most common questions in plant data architecture, and it is usually the wrong contest. MQTT is a lightweight publish and subscribe protocol built for many small devices on unreliable networks: a client publishes a state change to a broker, and the broker pushes it to subscribers. Apache Kafka is a distributed, durable log: producers append events to partitioned topics, and consumers pull them at their own pace and can replay history. One moves current state off the plant floor; the other keeps and serves event history to the enterprise.

So the practical answer for most manufacturers is both, each where it fits: MQTT at the edge and in the plant, Kafka (or a cloud equivalent) in the data centre or cloud, with a deliberate bridge between them. This page compares the two on the same dimensions and shows that pattern. It is part of our event-driven architecture guide.

Kafka vs MQTT at a glance

DimensionMQTTApache Kafka
What it isA messaging protocol, implemented by many brokersA distributed log platform with its own wire protocol
Standard and ownerOASIS standard; 3.1.1 is also ISO/IEC 20922:2016 (OASIS)Apache Software Foundation project, Apache 2.0 licence
Delivery modelBroker pushes to connected subscribersConsumers pull from the log and track their own offset
PersistenceUntil delivered; retained last value per topic; queues for persistent sessionsEvery event kept for a retention period, by time or size
ReplayNo standard replayAny consumer can rewind to an earlier offset
TopicsDeep hierarchy, + and # wildcards, created on publishFlat named topics, split into partitions, usually created deliberately
OrderingPer topic and client sessionPer partition
Delivery guaranteesQoS 0, 1 and 2 between client and brokerAt least once by default; exactly once within Kafka with idempotence and transactions (Kafka)
Client footprintSmall enough for gateways, controllers and embedded devicesHeavier clients, normally on servers
Device featuresLast will message, keep-alive, session stateNone of these; built for applications
Natural homePlant floor, edge, unified namespaceData centre or cloud, data platforms, stream processing

Read the table as two job descriptions. MQTT answers “what is the state of this machine now, and tell me when it changes”. Kafka answers “give me every event of this kind for the last thirty days, in order, and let me process it again tomorrow”.

How MQTT fits the plant floor

MQTT was designed in 1999 for telemetry over constrained links, and its features follow from that: a small binary header, a persistent TCP connection with keep-alive, a last will message that announces when a device drops off, and retained messages that give a new subscriber the current value immediately. The Sparkplug specification adds a topic namespace, a payload format and birth and death certificates for OT data on top. We cover MQTT itself in depth in our guide to MQTT in manufacturing, so this page does not repeat it.

The plant consequence: an edge gateway can report state by exception for thousands of tags with little bandwidth and little load on the controllers, and SCADA, MES and dashboards see the change in real time.

How Kafka fits the data centre and cloud

Kafka stores each topic as a set of partitions, each an append-only log replicated across brokers. Producers write; consumers in a consumer group divide the partitions between them and commit their position. Because events stay on disk for the retention period, any number of independent consumers can read the same history, and a new one can start from the beginning. Kafka 4.0, released in March 2025, runs only in KRaft mode without ZooKeeper (Kafka upgrade notes) and introduced Queues for Kafka (KIP-932) in early access, which adds point-to-point consumption alongside the log.

Patch cables glowing green inside a dark network rack in a server room
Kafka belongs where servers, storage and an operations team already are. Its value is history and fan-out to data platforms, not the last metre to a machine.

The plant consequence: quality, reliability and data science teams can analyse months of production events, rebuild a model from history, or add a new consumer without asking the plant to resend anything.

Why neither replaces the other

Kafka on the plant floor is the wrong shape. Each device would need a Kafka client, connections to several brokers, and topics planned in advance. There is no last will to tell SCADA a gateway died, and no retained current value for a dashboard that has just opened. Thousands of fine-grained tag topics also strain a platform designed around fewer, larger partitioned topics.

MQTT as the data platform is the wrong shape too. A broker deletes a message once it is delivered. If the analytics job was down on Tuesday, Tuesday’s events are gone unless a persistent session held them, and nobody can replay last quarter. Some MQTT brokers add persistence features, but they are vendor extensions, not part of the standard.

The common pattern: MQTT at the edge, Kafka in the core

MQTT at the plant edge bridged to Kafka in the data centre or cloud Left to right: at each of two plants, PLCs and machines feed an edge gateway, which publishes to a plant MQTT broker that also serves SCADA, MES and dashboards locally. A bridge from each plant broker crosses the DMZ to a Kafka cluster in the data centre or cloud. Topic hierarchy is mapped to a Kafka topic plus a message key. The Kafka cluster keeps history and serves a lakehouse, stream processing and machine learning consumers, which can replay events. MQTT carries current state off the floor; Kafka keeps and serves the history PLANT (OT) DATA CENTRE OR CLOUD (IT) PLCs, machines plant A PLCs, machines plant B Edge gateway Edge gateway MQTT broker plant UNS MQTT broker plant UNS local: SCADA, MES, dashboards DMZ Kafka cluster partitioned log retention, replay bridge bridge Lakehouse Stream processing ML and AI Mapping decision at the bridge: MQTT topic hierarchy becomes a Kafka topic plus a message key. The key decides ordering, so key by asset or batch, not by the whole plant.
The plant keeps working when the WAN or the data platform is down, because local consumers sit on the MQTT side. The bridge is where most design mistakes are made: decide the topic-to-key mapping before the first event crosses.

Ways to build the bridge. A Kafka Connect MQTT source connector subscribes to the plant broker and writes to Kafka. Several MQTT brokers ship their own Kafka integration. A proxy can accept MQTT and write to Kafka directly. An enterprise broker that speaks both protocols can sit between them; Solace’s Kafka integration is one example. Open-source UNS stacks such as the United Manufacturing Hub embed a Kafka-compatible buffer (Redpanda) inside the edge stack (UMH docs).

The mapping decision matters more than the tool. There are three common choices:

MappingExampleGood forWatch out for
One Kafka topic per MQTT topicsite1.packaging.line3.filler.stateSmall estates, easy debuggingTopic explosion; thousands of partitions
One Kafka topic per event type, MQTT path as keyTopic machine-state, key site1/packaging/line3/fillerMost plants: order per asset, few topicsConsumers filter by key, not by topic wildcard
One Kafka topic per siteTopic site1-events, key by assetData residency, per-site retentionMixed event types need a schema with a type field

In our IT/OT integration experience, the second option ages best: it keeps order for each asset, keeps the topic count manageable and lets the data team reason about event types rather than tag paths.

An illustrative scenario

A manufacturer with six plants runs an MQTT broker per site behind Ignition and a dashboard layer. The corporate data team wants machine states and quality results in its lakehouse, and reliability engineering wants to replay a year of stop events. Each plant bridges two event types, state and quality, into Kafka, keyed by asset. When the WAN to plant four fails for three hours, the plant keeps running on its local broker, and the bridge catches up when the link returns. Neither the controllers nor SCADA know Kafka exists. That separation is the point.

When Kafka does belong at a site

There are exceptions to “Kafka in the core”. A large site with its own analytics (a refinery, a semiconductor fab, a site with an on-premises data platform) may run a Kafka cluster locally, because the data volume is high and the consumers are on site. An edge buffer is the other case: some UNS stacks place a Kafka-compatible log at the plant so that events survive a long WAN outage and can be replayed into the cloud later. Redpanda, a Kafka-API-compatible broker written in C++ as a single binary, is often chosen for that role because of its smaller operational footprint.

Even then, devices and gateways usually keep speaking MQTT or OPC UA to the site, and the log sits one layer up. The test is who connects to it. If the answer is controllers and gateways, MQTT is the better fit; if it is applications and data pipelines, the log is.

Limits and open questions

  • Two platforms, two skill sets. MQTT brokers are often run by controls teams; Kafka by IT or data engineering. The bridge needs one owner.
  • Exactly once does not survive the bridge. Guarantees are per hop. Use unique event ids and idempotent consumers.
  • QoS 2 is not universal. Some brokers and cloud services accept QoS 2 but deliver at QoS 1. Check conformance notes, including those of enterprise brokers that speak MQTT.
  • Sparkplug payloads are Protobuf. Bridging Sparkplug into Kafka means either decoding it at the bridge or teaching every consumer to decode it.
  • Kafka is changing. Queues for Kafka and diskless designs are moving its boundaries, and IBM now owns Confluent, the largest commercial Kafka vendor (closed March 2026). Recheck vendor roadmaps before a long commitment.

How to evaluate a Kafka and MQTT design

  • Which consumers need current state only, and which need history or replay?
  • Where does each plant buffer events while the WAN or Kafka is unavailable?
  • How do MQTT topics map to Kafka topics and keys, and is that written down?
  • Which events cross the DMZ, and who approves a new one?
  • How are payload schemas versioned on both sides?
  • Who owns the bridge, monitors its lag and is paged when it stops?
  • What retention does the data team actually need, and what does it cost?

Deeper

There are no child pages under this guide yet. These go further:

Back to the event-driven architecture hub.

Frequently asked questions

Is Kafka better than MQTT?

Neither is better in general, because they do different jobs. MQTT is a lightweight protocol for many small devices and gateways that publish state changes over unreliable networks. Kafka is a distributed log for high-volume, durable, replayable event streams consumed by data platforms and applications. Most manufacturers who run both use MQTT at the plant edge and Kafka in the data centre or cloud.

Can Kafka replace an MQTT broker on the plant floor?

In most plants, no. Kafka clients are heavier than MQTT clients, Kafka has no equivalent of MQTT's last will message or retained last value per topic, and its topics are not designed for deep hierarchies with wildcard subscriptions across thousands of devices. Kafka can sit at a site as a buffer, but devices and gateways normally still speak MQTT or OPC UA.

Can MQTT replace Kafka for analytics?

Not on its own. An MQTT broker forwards messages and, at most, keeps the last value per topic and queues for offline sessions. It does not keep weeks of history for replay, and consumers cannot rewind. Analytics and machine learning teams usually need that history, which is why MQTT data is often streamed into Kafka or a cloud equivalent.

How do you connect MQTT to Kafka?

The common options are a Kafka Connect MQTT source connector, a Kafka integration built into the MQTT broker, a proxy that accepts MQTT and writes to Kafka, or an enterprise broker that speaks both. The design decision that matters most is how the MQTT topic hierarchy maps onto Kafka topics and message keys, because that decides ordering and how consumers filter.

Does MQTT support exactly-once delivery like Kafka?

MQTT defines QoS 2, exactly once between a client and the broker, although some brokers and cloud services downgrade it to QoS 1. Kafka offers exactly-once semantics within Kafka through idempotent producers and transactions. Neither guarantees exactly once end to end across a PLC, a broker and an ERP, so consumers should de-duplicate by event id.

References and further reading

  1. MQTT Version 5.0 · OASIS
  2. MQTT Version 3.1.1 · OASIS
  3. Apache Kafka documentation · Apache Software FoundationDesign, consumer groups and delivery semantics.
  4. Upgrading to 4.0 · Apache Software FoundationThe ZooKeeper removal and other 4.0 changes.
  5. KIP-932: Queues for Kafka · Apache Software Foundation
  6. Sparkplug Specification · Eclipse Foundation

← Event-Driven Architecture

Have a project that needs technical ownership?

Send us the situation. If it is not something we should take on, we will say so.