Skip to content

MQTT Client

Characteristics

MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). To learn more about the standard, visit the MQTT website.

Information Model Requirements

Hint

When publishing a topic, the Information Model dictates the payload's structure.

Hint

When subscribing to a topic, ensure that the Information Model structure aligns with the payload.

Complex Variables Nodes

MQTTClientModel01

Event Nodes

MQTTClientModel02

Configuration

Model

  1. Select the MQTT Client as Channel Type.
  2. Click the Configure button.

MQTTClientConfiguration01

  1. Select the root model node.
  2. Configure the MQTT client:

  3. Enter Host and Port of the MQTT Broker used.

  4. (Optional) Specify a Client ID.
  5. Set the Quality of Service (QoS).
  6. If required, configure the credentials.
  7. If required, configure TLS:

    • (Optional) Provide CA certificate to validate the host.
    • (Optional) Provide Client certificate and key file for client authentication.
    • (Optional) Provide a prefix for the topic that will be used when publishing messages.
    • If required, adjust the default values for Reconnect interval and the Unit.
    • (Optional) Change the default message options. These can be overwritten for each event.

MQTTClientConfiguration02

Events

  1. Select the event node in the tree on the left.

  2. Select the Direction (Producer or Consumer).

  3. For Producer, set Retain if required.
  4. Configure the topic.
  5. Optional: Override the default message options.

MQTTClientEvent01

Variables

  1. Select the variable node in the tree on the left.

  2. Select the Direction (Producer or Consumer).

  3. For Producer, set Retain if required.
  4. Configure the topic.
  5. Optional: Override the default message options.

MQTTClientVariable01

Topics

The topics for publishing and subscribing can be configured in a static but also dynamic way, where variables and properties are used within the topic.

Producer

  • In the Model configuration, a prefix (Producer topic prefix) can be configured.
  • This prefix will be automatically added to the topics for producer events and variables.
  • If variables/properties are going to be used, they need to be written in the ${VariableName} pattern.
  • In the producer prefix, only variables that are directly in the root node of the Model can be used.
  • In the topic configuration of the events/complex variables, only variable and properties with the complex variable can be used.
  • If the topic in the event/complex variable configuration starts with a /, then the prefix will not be added.

Example

Following variable values are used in the example:

Name Value
Factory MyFactory
Line MyLine
Device MyDevice
Chamber 15

Topic Configuration

Producer Prefix Event / Complex Variable Topic Topic (Example)
MyCompanyNamespace Complex variable: Metrics MyCompanyNamespace/Metrics
Factory:${Factory}/Line:${Line}/Device:${Device} Complex variable: Chamber:${Chamber}/Metrics Factory:MyFactory/Line:MyLine/Device:MyDevice/Chamber:15/Metrics
Factory:${Factory}/Line:${Line}/Device:${Device} Complex variable: /Chamber:${Chamber}/Metrics /Chamber:15/Metrics

Consumer

  • In the Model configuration, a prefix (Consumer topic prefix) can be configured.
  • This prefix will be automatically added to the topics for consumer events and variables.
  • Variables/properties can be used as wildcards in events and complex variables. They need to be written in the ${VariableName} pattern.
  • Wildcards are not supported in the prefix.
  • Wildcards variables/properties can only be used for an entire topic segment. For example, MyNamespace/${Factory}/Metrics will be translated into MyNamespace/+/Metrics.
  • A partial topic segment is not possible. For example, MyNamespace/Factory:${Factory}/Metrics.
  • If the topic in the event/complex variable configuration starts with a /, then the prefix will not be added.

Example

Consumer Prefix Event / Complex Variable Topic Topic (Example)
MyCompanyNamespace Complex variable: Metrics MyCompanyNamespace/Metrics
MyCompanyNamespace Complex variable: ${Factory}/${Line}/${Device}/${Chamber}/Metrics MyCompanyNamespaceFactory/+/+/+/+/Metrics