MQTT Engine has a number of configuration options that provide flexibility when connecting and subscribing to servers.
This document will step through each of the configuration options with examples of how they might be used.
MQTT Engine Sets and Servers
The MQTT Engine Sets tab contains a list of server sets where each set represents a logical grouping of MQTT servers.
The MQTT Engine Servers tab provides a list of the MQTT Servers that MQTT Engine should connect to with each server associated with a Server Set. Multiple servers can be associated with the same Server Set providing fail-over in redundant or geographically distributed systems.
A single connection is made to the first available server in each set. If this server becomes unavailable, MQTT Engine will attempt to establish a connection with the next server in the set. If unsuccessful, it will continue to walk through the servers in the set until a connection can be made.
If multiple concurrent server connections are desired, each one should be associated with a unique Server Set.
The MQTT Engine Sets tab also contains the Primary Host configuration for all servers associated with the server set.
MQTT Engine Servers - Filtered Namespaces
The MQTT Engine Servers (Advanced) tab contains the Filtered Namespaces configuration.
This configuration option allows for a comma separated list of namespaces that will be filtered/disabled for connections to this MQTT Server.
This filter applies to both the default namespaces (Elecsys, Xirgo, Sparkplug A and Sparkplug B) and any custom namespaces configured.
Example
A system with Edge devices publishing using the Sparkplug B protocol to Server A and Edge devices publishing MQTT messages to another Server B.
MQTT Engine will have two server connections configured:
- Server A Set 1
- Server B Set 2
In this instance the Access Control Lists (ACLs) on Server B may not allow for the subscriptions required by MQTT Engine for the Sparkplug B protocol. Setting the Filtered Namespaces for the MQTT Engine Server configuration for Server B to "Sparkplug B" will disable the namespace for this server connection.
MQTT Engine Namespaces Default - Sets
The MQTT Engine Namespaces > Default > Sets tab allows for specific Server Sets to be associated with the namespace.
This configuration allows for a namespace to be associated with a specific server set(s) and applies to all servers in the server set.
Example
A system with Edge devices publishing using the Sparkplug B protocol to Server A using Set1 and Edge devices publishing MQTT messages to a failover server pair Server B and Server C using Set2.
MQTT Engine will have three server connections configured:
- Server A Set 1
- Server B Set 2
- Server C Set 2
In this instance the Access Control Lists (ACLs) on Servers B and C may not allow for the subscriptions required by MQTT Engine for the Sparkplug B protocol. Associating the Sparkplug B namespace only with Set 1 will disable the namespace for the two server connections associated with Set 2.
MQTT Engine Namespaces Default - Filters
The MQTT Engine Namespaces > Default > Filters tab allows for specific Group or Group/EdgeNode combinations to be included in the MQTT Engine subscriptions to specific MQTT Servers.
Example for the Sparkplug B namespace
Setting the Group ID to 'Location1' will limit the subscriptions on the specific server to:
- spBv1.0/Location1/#
- spBv1.0/STATE/primary_host_id
Setting the Group ID to 'Location1' an Edge Node ID to 'Stream1' will limit the subscriptions on the specific server to:
- spBv1.0/Location1/+/Stream1
- spBv1.0/STATE/primary_host_id
MQTT Engine Namespaces Custom - Sets
Custom Namespaces are used to provide support for generic, non Sparkplug compliant MQTT messages with string based payloads. The MQTT Engine Namespaces > Custom > Sets tab allows for specific Server Sets to be associated with the namespace.
This configuration expands on the MQTT Engine Servers - Filtered Namespaces by applying to all servers in a specific server set. If connection is switched to another server within the same server set, filtered namespaces are applied.