Sparkplug B Overview
Sparkplug B is an open specification that defines how industrial devices use MQTT. Plain MQTT standardizes only the transport: it says nothing about how topics are named, what a payload contains, or how a subscriber knows whether a device is online. Sparkplug B acts as a common specification that solves for these gaps, so a subscriber can read a compliant device without being told anything about its message format in advance.
GENESIS subscribes to Sparkplug B data through a Sparkplug subscriber connection, configured under Data Connectivity > Internet of Things > Subscriber Connections. Because the format is standardized, no custom decoder is involved: point the connection at a broker and a topic, and the devices, their tags, data types, and quality appear in the GENESIS address space. Learn more
The Sparkplug Topic Namespace
Every Sparkplug B topic follows a fixed structure:
-
spBv1.0—The namespace that identifies the message as Sparkplug B.
-
group_id—A logical grouping of edge nodes, typically a site, plant, or area.
-
message_type—What the message is, described below.
-
edgenodeid—The gateway or controller that owns the connection to the broker.
-
device_id—An optional device attached behind that edge node.
Because the structure is fixed, a subscriber can select what it wants with MQTT wildcards without knowing device names. A base topic of spBv1.0/MyGroup/+/MyEdgeNode/# receives every message type, from the node and from all devices beneath it, for MyEdgeNode in MyGroup.
Message Types and State
The message type in the topic tells a subscriber what a payload means:
|
Message type |
Meaning |
|---|---|
|
NBIRTH, DBIRTH |
Birth certificate for an edge node or a device. Describes the complete set of metrics the sender publishes, with names, data types, and initial values. |
|
NDATA, DDATA |
A data update, carrying only the metrics that changed. |
|
NDEATH, DDEATH |
The sender has gone offline. NDEATH is registered with the broker as an MQTT will message, so the broker publishes it even when the node disappears without warning. |
|
NCMD, DCMD |
A command sent to an edge node or device, which is how writes travel back from a subscriber. |
|
STATE |
The online or offline state of a primary application consuming the data. |
Birth and death messages are Sparkplug B's use of the birth and will mechanism that MQTT provides. Learn more
Rebirth Requests
Because the address space is built from the birth message, a subscriber that starts up in the middle of an established session has no description for the data it is receiving. Sparkplug B handles this with a rebirth request: the subscriber asks the device to publish its birth certificate again.
GENESIS sends rebirth requests automatically when it receives data updates from a device whose birth message it never saw. Three settings on the Sparkplug subscriber connection control this behavior:
-
Birth Wait Period—How long to wait for a birth message before sending the first rebirth request.
-
Rebirth Repeat Period—How long to wait between successive rebirth requests to a device that has still not responded.
-
Retry Count—How many rebirth requests to send before giving up on that device.
Leave rebirth enabled unless the devices on the broker are known not to support it. Without it, a subscriber restart can leave data arriving that GENESIS cannot resolve to named metrics.