MQTT Configuration Guide

This guide provides comprehensive instructions for setting up and configuring the MQTT collector for Factry Historian. It includes installation steps, connection setup, and best practices for secure and reliable data transmission.

Collector Installation

To install the MQTT collector, follow the steps outlined in the Collector Installation Guide .

Connecting the MQTT Collector to a Broker

To connect the MQTT collector to your broker, ensure the following configurations are properly set up:

Authentication

  • Provide the username and password required for broker authentication.

Secure Communication (TLS)

  • Use a CA certificate to validate the broker’s identity.
  • For mutual TLS, include the client certificate and private key.

Note: While TLS is optional, it is highly recommended for secure environments to ensure encrypted communication and prevent unauthorized access.

Quality of Service (QoS)

MQTT supports three levels of Quality of Service (QoS), each offering different guarantees for message delivery:

Level Description Guarantee Use Case
QoS 0 At most once No guarantee of delivery Non-critical data
QoS 1 At least once Message delivered at least once (may duplicate) Recommended for most industrial use
QoS 2 Exactly once Message delivered exactly once Critical data, higher overhead

Recommendation: Use QoS 1 or QoS 2 to ensure reliable delivery of measurement data.

Topics

MQTT topics are used to route messages. The collector subscribes to specific topics to receive data.

  • Topics act as filters — the collector only processes messages from subscribed topics.
  • Measurement configurations can only extract data from these subscribed topics.

Wildcards in Topics

MQTT supports wildcards for flexible topic subscriptions:

Single-Level Wildcard: +

Matches exactly one level of a topic.

Example:
factory/+/temperature matches:

  • factory/machine1/temperature
  • factory/machine2/temperature

Multi-Level Wildcard: #

Matches multiple levels (including zero) and must be the last character in the topic.

Example:
factory/# matches:

  • factory/machine1
  • factory/machine1/temperature
  • factory/machine2/status/online

For more information and best practices, refer to:
MQTT Topics Best Practices – HiveMQ