Networking

MQTT and Sparkplug: a shared contract for industrial data

MQTT carries messages but does not define a data model. Sparkplug fills that gap by standardizing topic names and payload structure.

In short
  • MQTT provides topics, quality-of-service levels, retained messages and last-will messages, but it leaves the topic hierarchy and message content to the application.
  • Sparkplug defines the topic namespace, payload format and device state on top of MQTT, with birth and death messages showing which values are current.
  • An unknown value and a zero value are different states, and the consuming layer must preserve that difference.

What MQTT provides

MQTT is a lightweight publish/subscribe messaging protocol working through a broker. It offers topic names, quality-of-service levels, retained messages and a last-will message sent when a connection drops. The topic hierarchy and the message content are left to the application, which is why two vendors’ MQTT do not automatically understand each other.

What Sparkplug defines

Sparkplug is a specification defining a topic namespace, payload format and device state management on top of MQTT. When a device connects, a birth message announces all its tags and types; when it leaves, a death message is published. A subscriber therefore knows which values are current and which are stale.

Data quality and time

Each value in the payload can come with a timestamp and a data type. You should still document whether the timestamp is produced at the source or at the gateway. A value being “unknown” and being “zero” are different states; the consuming layer must preserve the difference.

Connecting to an AI pipeline

A model or data lake should subscribe to a registered, versioned consumer layer, not directly to device topics. Manage topic names and tag names as a contract. This guide is a general architecture suggestion; details depend on the specification version of the product used.

Frequently asked

What is the difference between MQTT and Sparkplug?

MQTT is a lightweight publish/subscribe protocol working through a broker, but it does not define a data model. Sparkplug standardizes topic names, payload structure and device state on top of MQTT. A device announces its tags with a birth message when it connects and publishes a death message when it leaves.

How should an AI pipeline subscribe to Sparkplug data?

A model or data lake should subscribe to a registered, versioned consumer layer, not directly to device topics. Manage topic names and tag names as a contract. Document whether the timestamp is produced at the source or at the gateway, and check the specification version of the product used.

Sources and further reading

Pilot steps in this guide are proposed engineering workflows. Examples do not constitute measured field performance.

Questions on this topic