Today, I would like to discuss a particular aspect of designing the MQTT Topic Structure: Should we include an asset’s Physical Location in the MQTT Topic? That is a complex subject, so that I will break it down.
Asset Type
For consumer electronics like wearables, the location of an asset may be irrelevant or unknown. Even if the use case demands tracking position, we should not record it as a part of the MQTT Topic (devices should send the location in the payload of an MQTT Message stored in a database at the backend).
In contrast, storing the position of industrial assets like robots operating in factories as part of the MQTT Topic is crucial for maintenance and monitoring.
MQTT Topic Structure
Let’s take the following MQTT Topic as an example:
dt/company_a/site_001/line_03/device_0001
The simulated robotic arm device_001
functions at site_001
, on line_03
. Simply looking at the MQTT Topic gives us a lot of information about that asset.
How can we use that metadata in practice? Let’s say there is a Maintenance Engineer at every site belonging to the company_a
. Each person should receive notifications relevant to the specific site on which they reside.
Our simulated engineer works at site_001
and subscribes to the dt/company_a/site_001/+/+
MQTT Topic.
This way, the employee will receive notification regarding any device (dt/company_a/site_001/+/+) operating at any line (dt/company_a/site_001/+/+) located at site_001
(dt/company_a/site_001/+/+).
We can effectively organize communication and provide subscribers with only relevant information. The proposed organization of MQTT Topics restricts unauthorized data access, improving our security posture.
A carefully designed MQTT Topic Structure leverages metadata consistently and meaningfully to facilitate efficient routing and filtering of messages.
Improved Scalability
As the number of assets and sites grows, including the location in the MQTT Topic Structure helps maintain a logical and organized topic hierarchy, making it easier to manage and monitor large-scale deployments.
Contextual information about the asset’s location is helpful for data analysis, troubleshooting, and maintenance.
Summary
Deciding whether to include physical location in the MQTT Topic Structure depends on various factors, such as asset type, nature of deployment, use case, and business requirements. By carefully considering these factors and implementing best practices, enterprises can effectively leverage MQTT for communication and management.
Let me know if you find this topic interesting!