Skip to main content

MQTT

The MQTT component is the central communication hub through which all MQTT communications between components happen.

Open Source Example

ACS MQTT Component

See how the AMRC have implemented this component in the AMRC Connectivity Stack
View on Github

Overview

Identity
Authorisation
Identity
Authorisation
Directory
Configuration Store
Manager
Commands
Data Warehouse
MQTT
Edge Agents

Similar to the Data Warehouse Component, Factory+ does not prescribe a particular specification for the MQTT Component; it only necessitates that any chosen solution be MQTT 3.1 compatible. There are however a few requirements of any chosen MQTT broker that must be satisfied to ensure compatibility with Factory+.

Authentication & Authorisation

Any chosen MQTT broker must be able to authenticate users via Kerberos and enforce fine-grained access control for topic management via rules from the Authorisation Component.

Using HiveMQ?

If you are using HiveMQ, our Factory+ plugin will handle this for you.

Well-Known UUIDs

These well-known UUIDs are part of the core framework and all MUST to be registered with the Configuration Store component under the appropriate classes.

Identity

Service Function
MQTT
feb27ba3-bd2c-4916-9269-79a61ebc4a47
MQTT Component service function

Service Account
MQTT
2f42daeb-4521-4522-8e19-85dfb73db88e
The client identity of the MQTT Component used to communicate with other services

Permission Groups

Permission Group
MQTT permissions
a637134a-d06b-41e7-ad86-4bf62fde914a
All MQTT permissions need to be in this Group

Any UUIDs created representing MQTT permissions MUST be added to this group in the Authorisation Component, otherwise the MQTT component will not be able to see the ACEs.


Permissions

Global

Permission
Subscribe To Whole Namespace
21000098-3a53-48da-8d3e-cc0650603d8e
Subscribe to all topics for the whole namespace
{
"spBv1.0/#": "s"
}

Permission
Subscribe & Read Whole Namespace
81833dbb-1150-4078-b1db-978c646ba73e
Subscribe to and read all topics for the whole namespace
{
"spBv1.0/#": "rs"
}

Permission
Issue Global Commands
50f1e694-7e18-4930-aa59-97cc90a6a1ec
Issue NCMD messages to any Node or Device
{
"spBv1.0/+/NCMD/+": "w",
"spBv1.0/+/DCMD/+/+": "w"
}

Permission
Subscribe & Read All States
8790cf3d-b793-423c-b373-8cfcf9f63529
Read the STATE topic
{
"STATE/+": "rs"
}

Permission
Read All Birth Messages
67dc4dd0-0939-42b1-b1f9-9049f4d91d40
Read all BIRTH messages across the entire namespace
{
"spBv1.0/%g/DCMD/%n/#": "rs",
"spBv1.0/%g/DDATA/%n/+": "w",
"spBv1.0/%g/DBIRTH/%n/+": "w",
"spBv1.0/%g/DDEATH/%n/+": "w"
}

Group

Permission
Update Group State
9a32f195-a8cc-4562-a87a-d4653279474f
Write to the Group's STATE topic
{
"STATE/%g": "w"
}

Permission
Publish All From Group
64c019f8-6754-4270-8917-6659a5628b86
Write to any topic under the Node
{
"spBv1.0/%g/#": "w"
}

Permission
Subscribe & Read Own Group
d617e37c-3908-41b1-8820-d3f8d41a4280
Subscribe to and read all topics for the specified Group
{
"spBv1.0/%g/#": "rs"
}

Permission
Issue Group Commands
cff45682-f2f0-4c72-91f3-7dda20d43509
Issue commands to the specified Group
{
"spBv1.0/%g/NCMD/+": "w",
"spBv1.0/%g/DCMD/+/+": "w"
}

Node

Permission
Participate as Node
a1314953-8226-44f4-8a3e-e87b09310579
Write to the NDATA, NBIRTH and NDEATH topics and read and subscribe to the NCMD topic for the Node
{
"spBv1.0/%g/NDATA/%n": "w",
"spBv1.0/%g/NBIRTH/%n": "w",
"spBv1.0/%g/NCMD/%n/#": "rs",
"spBv1.0/%g/NDEATH/%n": "w"
}

Permission
Subscribe & Read Node
046d6603-fa62-4208-9400-65d61f8b1ec4
Subscribe to all relevant topics for a specific Node
{
"spBv1.0/%g/NDATA/%n": "rs",
"spBv1.0/DDEATH/%n/+": "rs",
"spBv1.0/%g/NBIRTH/%n": "rs",
"spBv1.0/%g/NDEATH/%n": "rs",
"spBv1.0/%g/DDATA/%n/+": "rs",
"spBv1.0/%g/DBIRTH/%n/+": "rs"
}

Permission
Update Own State
bdc96a3e-d6fb-48ed-b790-0aa95cf826f0
Write to the Node's STATE topic
{
"STATE/%n": "w"
}

Device

Permission
Represent Devices
e82456b3-a7d9-4971-9d8c-fd0be4545ab4
Publish to a Device's topics
{
"spBv1.0/%g/DCMD/%n/#": "rs",
"spBv1.0/%g/DDATA/%n/+": "w",
"spBv1.0/%g/DBIRTH/%n/+": "w",
"spBv1.0/%g/DDEATH/%n/+": "w"
}

Roles

Role
Edge Node
87e4a5b7-9a89-4796-a216-39666a47b9d2
A Role for all Edge Node principals

The Edge Node role MUST be granted to all principals used for edge agents and MUST have the following Permissions:

PermissionUUID
MQTT: Subscribe & Read All States8790cf3d-b793-423c-b373-8cfcf9f63529
MQTT: Participate as Nodea1314953-8226-44f4-8a3e-e87b09310579
MQTT: Represent Devicese82456b3-a7d9-4971-9d8c-fd0be4545ab4

Applications

Application
MQTT Permission Template
1266ddf1-156c-4266-9808-d6949418b185
Expands a permission recognised by the MQTT plugin to an MQTT ACL

UUIDs representing MQTT permissions need to have a Configuration Store entry of this type. This entry serves as a template for the MQTT permissions granted when the given permission UUID is granted in the Authorisation Component.

The entry MUST be a JSON object. Keys represent MQTT topics; values represent the access granted to that topic. Values MUST be strings, as defined below.

Topic names support the normal MQTT + and # wildcards. In addition, if any of the percent sequences below appear in the topic name, the target of the relevant ACE will be looked up under the 'Sparkplug Address' application below. The percent sequence will be expanded to the relevant property of the entry returned. If there is no such entry the topic will be ignored (no permission will be granted).

SequenceProperty
%ggroup_id
%nnode_id

The access granted is specified as a string containing one or more of the characters below.

AccessMeaning
rRead data published to the given topic.
wPublish to the given topic.
sAllow subscription to the given topic.

The s code is intended for implementations that distinguish between 'subscribe' and 'read' permissions. A client granted s permission SHOULD be allowed to request subscription to the given topic, but MUST NOT be sent packets for that topic unless r permission is also granted.

Not all implementations will implement the s permission. Implementations that do not MAY refuse subscription requests for topics that do not have r permission. Currently the ACS HiveMQ plugin does not implement s.