SmartSwarm 300 Series
:
137
●
A '#' character represents a complete sub-tree of the hierarchy and thus must be the last character in a
subscription topic string, such as SENSOR/#. This will match any topic starting with SENSOR/, such as
SENSOR/1/TEMP and SENSOR/2/HUMIDITY.
●
A '+' character represents a single level of the hierarchy and is used between delimiters. For example,
/TEMP will match SENSOR/1/TEMP and SENSOR/2/TEMP.
With a carefully designed topic space it becomes possible to implement very powerful searching, filtering and
combination of data simply by manipulation of the wildcards used within subscriptions.
There are a few rules to remember when designing a topic space schema:
•
Topic names are case-sensitive. For example, "CITY", “City“ and "city" are all recognized as different
topic names.
•
Topic names can include spaces, which are treated just like any other character. “building A“ and
“building B“ are both valid constructs representing different entities.
•
While it is not recommended, a topic level may contain a null string. For example,
"company//building" is a three level topic name whose middle level is empty.
•
It is recommended that topic names do not include the null character (Unicode \x0000).
•
There is no effective limit to length of the overall topic name string. (But it should be remembered
that the topic is transmitted and so overly long topics may result in high data charges if using, for
example, cellular communications).
•
There is no limit to the levels of depth (number of slash-separated strings) in a topic tree.
•
There is no limit to the length of any particular level name in the tree (but again, this will impact data
usage).
•
There may be any number of "root" nodes (that is, any number of topic trees).
Topic
Description
MyCo/Galway/building A/Warehouse
Data relating to the warehouse in building A located in
Galway for my company
MyCo//Warehouse
Data for warehouse facilities in all MyCo buildings in Galway
MyCo/Galway/building A/+
Data from all rooms in building A operated by MyCo in
Galway
MyCo/Galway/#
All data from all buildings operated by MyCo located in
Galway
MyCo/#
All data from all MyCo buildings
Table 53. Examples for subscribing to different topics in a hierarchical name space
As can be seen from the above table, a well-designed topic space will segregate data into subject trees which
simplify the gathering of data in the cloud.
System
Efficiency and Reliability
MQTT was conceived for use in 24/7, mission critical applications. As such, MQTT includes concepts such as
‘Quality of Service’, which allow users to control how reliably messages are received by subscribers. Fire & forget,
deliver at least once, or deliver once and once only, each with different levels of handshake within the underlying
messaging system.
Also included is a ‘last will & testament’ message. This is a special category of message which, when published, is
not immediately forwarded to all subscribers. Instead, it is held by the middleware server on behalf of the
publishing device, and is republished should the originating unit disappear from the network in an unexpected