Understanding MQTT Sparkplug Topic Namespace in IIoT Architectures
In the last blog post we explored the many advantages Sparkplug´s decoupled push-based architecture has compared to traditional poll-response protocols like Modbus or OPC-UA. This blog post discovers how to overcome challenges of disparate MQTT Topic formats in IIoT and how Sparkplug standardizes MQTT Topic Namespace.
A standout feature of MQTT that has allowed it to gain widespread acceptance across many sectors is that it permits using any format for creating hierarchical topic paths. For example, DairyPlant01/Refrigerator03/DischargePressure could be used as a customized topic namespace in a dairy manufacturing enterprise.
While this flexibility allows you to define MQTT topic structures as needed, it also presents challenges when scaling or integrating diverse systems due to the absence of a standardized approach. Moreso in Industrial IoT (IIoT) or SCADA networks, where there are often complex industrial settings with nested devices, assets, and systems.
Challenges of Disparate MQTT Topic Formats in IIoT
Below are some of the challenges introduced due to the lack of a systematic and consistent MQTT topic naming format:
IT-OT Interoperability Challenges
Different devices and applications that use varying MQTT topic structures can be difficult to integrate into a unified system. This leads to difficulty in communicating and exchanging data from different vendors or different business units of an industrial operation.
As the number of devices or topics grows, configuring, managing and monitoring a large network of non-standardized MQTT topic structures becomes increasingly complex. This often leads to a reduced ability to scale and adds to the cost of integration.
If devices or publishers use different topic structures or naming conventions, there might be ambiguity about the source or type of data, leading to potential data inconsistency. In IIoT or SCADA systems, misinterpretation or misrouting of data can lead to operational issues or even safety concerns.
Benefits of Standardized MQTT Topic Namespace in IIoT
In order to mitigate many of the aforementioned challenges, the MQTT Sparkplug specification defines a standard MQTT topic format for IIoT networks. By providing a standardized topic namespace definition, MQTT Sparkplug helps to create a more consistent, organized, and interoperable landscape for MQTT-based IIoT and operational data systems. This makes it easier to deploy, manage, and scale these systems while also ensuring that data is easy to access and understand.
With Sparkplug’s standard topic namespace definition, devices and systems that follow the Sparkplug specification can communicate with one another without any additional configuration or transformation. In addition, Sparkplug’s topic namespace provides a consistent and logical organization for data, ensuring that similar data points are grouped together and that data is easy to locate.
As more devices and systems adopt the Sparkplug specification, integration becomes simpler. Instead of customizing integrations for each unique topic structure, systems can be integrated using a standard set of rules and logic.
By standardizing topic structures, it’s easier to implement fine-grained security and access control measures. For instance, permissions can be granted based on specific sections of the topic namespace, ensuring that devices and users only have access to the data they are authorized to see.
Components of the MQTT Sparkplug Topic Namespace
To provide a structured way to ensure that messages are easily routed, understood and acted upon in an IIoT environment, Sparkplug breaks down the MQTT topic namespace into specific components. Consequently, the structured nature of the Sparkplug topic namespace appears as follows:
spBv1.0/[Group ID]/[Message Type]/[EON Node ID]/[Device ID]
Here’s a detailed look at the components of the MQTT Sparkplug topic namespace:
This always begins with “spBv1.0” to indicate that the topic is using the Sparkplug B version 1.0 specification. This serves as an identifier for the protocol version being used, as well as the encoding used for the associated payload data.
This identifies a logical grouping of Edge of Network (EoN) nodes and devices. For example, you might use a group ID to represent a particular factory or plant location. It ensures data segregation between different groups, aiding in efficient data management and security.
The message_type component of the topic namespace signals how the MQTT payload should be processed. The following message_type components are defined for the Sparkplug topic namespace:
- NBIRTH: Edge node BIRTH certificate. This is a startup message from an EoN to announce its presence and share its configurations.
- NDEATH: Notification of an edge node’s disconnection or failure.
- DBIRTH: Device BIRTH certificate. Like the NBIRTH but for devices, announcing their presence and configurations.
- DDEATH: Notification of a device’s disconnection or failure.
- NDATA: Data messages from an edge node. These typically include metric data.
- DDATA: Data messages from a device. Similar to NDATA but specifically for device-related metrics.
- NCMD: Command to an edge node.
- DCMD: Command to a device.
- STATE: It represents the state of the primary host application. Edge nodes subscribe to it to get the online status of the host.
Edge of Network (EON) Node ID
This uniquely identifies a specific edge node within EoNs in the same group. EON nodes are responsible for reporting data on behalf of devices they control or are connected to. The EON node ID helps in directing commands to the correct node and segregating data from various nodes.
Device ID (Optional)
If the message relates to a specific device controlled by the edge node, the device ID uniquely identifies that device.
Below is a table showing the examples description and examples for each of the MQTT Sparklug topic namespace components.
|Root element to set the sparkplug version
|Logical grouping of MQTT edge nodes
|Specific message type
|ID of a specific edge node
|ID of a specific device tied to an edge node
It’s essential to note that the edge node descriptor, formed by combining the group ID and edge node ID, must be distinct among all edge nodes in your MQTT Sparkplug network. This means that no two edge nodes in a Sparkplug setting can share identical group IDs and edge node IDs.
Implementing Sparkplug Topic Namespace in Real-world Scenarios
Let’s look at examples of benefits of MQTT Sparkplug topic namespace definition in real-world scenarios.
For instance, In a smart manufacturing facility, each production line might consist of numerous machines, each generating metrics like temperature, uptime, and error rates. Using Sparkplug’s topic namespace, messages from these machines are easily routed and categorized. A topic such as spBv1.0/FactoryA/DDATA/Line3/Machine7 immediately provides context about the source and nature of the message, ensuring that monitoring tools, control systems, and operators can quickly process and act on the data.
Moreover, Sparkplug’s topic namespace goes beyond just efficient routing; it plays a pivotal role in system diagnostics and troubleshooting. In the energy sector, for instance, a solar farm with multiple panels can benefit immensely from Sparkplug’s structured messaging. Should a panel malfunction, a message with a topic like spBv1.0/SolarFarmB/NDEATH/PanelArray5/Panel23 would instantly notify operators not just of a problem, but its exact location in the infrastructure. This granularity and clarity in communication, made possible by Sparkplug’s topic namespace, are invaluable in real-world scenarios where rapid response times can lead to significant savings and safer operations.
In summary, MQTT Sparkplug is a specification designed to ensure the interoperability of devices, applications, and services that communicate using the MQTT protocol, especially in the industrial automation sector. The topic namespace defined in Sparkplug plays a pivotal role in providing a standardized topic structure which ensures consistent data representation, streamlined device command and control, and improved state management across various devices and systems.
By adhering to the Sparkplug topic namespace, vendors and system integrators can seamlessly integrate devices and software solutions, thereby reducing integration efforts and ensuring more predictable and reliable communication in MQTT-based IIoT deployments.
In Part 5 of our MQTT Sparkplug Essentials series, we’ll explore MQTT Sparkplug Session State Management in IIoT Communication. Stay tuned.
If you have questions about how the MQTT Sparkplug topic namespace can be applied to your architecture, contact us, and we’ll be happy to discuss your specific needs.
About Kudzai Manditereza
Kudzai is an experienced Technology Communicator and Electronic Engineer based in Germany. As a Developer Advocate at HiveMQ, his goals include creating compelling content to help developers and architects adopt MQTT and HiveMQ for their IIoT projects. In addition to his primary job functions, Kudzai runs a popular YouTube channel and Podcast where he teaches and talks about IIoT and Smart Manufacturing technologies. He has since been recognized as one of the Top 100 global influential personas talking about Industry 4.0 online.
Follow Kudzai on LinkedInContact Kudzai