Skip to main content

MQTT Plug-in Configuration

This page describes how to configure the MQTT broker connection. The actual message processing is then handled by the MQTT transfer object, MQTT Subscribe, or the MQTT Storage Read Transfer Object.

Overview

The MQTT plug-in establishes the connection to the broker. If you want to receive MQTT messages and use them to trigger flows, you must also use MQTT Subscribe. To publish messages, use the MQTT Transfer Object.

MQTT plugin, Router configuration tab


Router Settings​

FieldDescription
NameAssign a unique name to the MQTT connection.
Cloud ProfileSelect the desired profile: MQTT Standard, AWS, Azure IoT, Wago Cloud.

You can use Test Connection to verify the current connection.

Cloud Profiles​

The cloud profiles extend the standard configuration with additional tabs:

info

For more information on using MQTT and the cloud profiles, see our knowledge base:

https://www.opc-router.de/knowledge-base/


Connection Options​

MQTT Plug-in, Connection Options

Connection Details​

FieldDescription
Broker ConnectionEnter the address of the MQTT broker. In the screenshot, mosquitto is entered as an example.
PortThe broker’s TCP port. When Enable TLS/SSL is enabled, 8883 is typically preset; without TLS/SSL, 1883 is generally used.
MQTT VersionSelect the protocol version. In the screenshot, MQTT 3.1.1 is selected as an example.
Quality of Service TypeSelection of the standard QoS: 0—at most once, 1—at least once, or 2—exactly once.
Performance

For details on latency, network round trips (RTT), and internal synchronization during publish operations, see MQTT Performance.

Authentication​

FieldDescription
UsernameUsername for logging in to the broker.
PasswordSelect a secret. Use the buttons to create, edit, or delete a secret.
Client IDUnique client ID. Supports the placeholders ${hostname}, ${hostname:lower}, #[INSTANCE], #[INSTANCE:<numeric value>], and #[RAND:<numeric value>]. This allows you to automatically generate different IDs per instance during connection pooling or project synchronization. A preview of the generated client ID is displayed below the input field.
ButtonsRandom generates a random ID. Client ID Template inserts the default template into the input field.

Enable TLS/SSL​

FieldDescription
Enable TLS/SSLEnables an encrypted connection to the broker. The TLS/SSL settings below can only be edited when this option is enabled.
SSL ProtocolsSelection of supported protocols, such as TLSv1, TLSv1.1, TLSv1.2, or TLSv1.3. Multiple protocols can be enabled.
Client CertificateSelection of a client certificate for logging in to the broker. Use the buttons to remove, add, view, or delete certificates.
Trusted CertificatesSpecify which certificates are accepted, such as Router, Windows, or All (unsafe).

Storage​

FieldDescription
Enable MQTT Data StorageWhen enabled, the last received MQTT message for each topic is saved to disk. This feature is required to use the MQTT Storage Read Transfer Object.
PatternA subscription is created for each added topic pattern. Supports the wildcards + and #.
NoteFree-form text describing the purpose or origin of a topic.
How It Works

When the MQTT Data Storage feature is enabled, the OPC Router creates automatic subscriptions for all entered topics. The received messages are stored persistently, but only the latest message per topic is retained. Older values are overwritten.

These stored values can be retrieved specifically using the MQTT Storage Read transfer object.


First Will​

FieldDescription
Enable First WillEnables the sending of a First Will when establishing a connection.
Retain First WillBroker stores the message for later delivery.
TopicTarget topic for the First Will.
PayloadContent of the First Will message.
Quality of ServiceQuality of service (0, 1, or 2).

Last Will​

FieldDescription
Enable Last WillEnables sending a message if the connection is lost.
Retain Last WillThe broker stores the message for later delivery.
Send Last Will on Connection DisconnectionSends Last Will even when the connection is manually terminated.
TopicTarget topic for the Last Will.
PayloadContent of the Last Will message.
Quality of ServiceService quality (0, 1, or 2).

Advanced​

Connection Pool​

FieldDescription
Enable Connection PoolWhen enabled, a single connection is used for subscriptions and multiple connections for publish operations. Useful for high message volumes.
Min. ConnectionsMinimum number of connections.
Max. ConnectionsMaximum number of connections.
Timeout LimitTime in minutes after which inactive connections are closed.

Flow Control​

FieldDescription
Enable Flow ControlEnables the send quota for brokers that do not report their own limit (Receive Maximum, starting with MQTT 5). A limit reported by the broker is always honored, even if this option is disabled.
Send QuotaMaximum number of concurrent unacknowledged send operations (QoS 1 and 2) per connection. Values that are too low limit throughput with slow or remote brokers; values that are too high may cause the broker to throttle or terminate the connection. When connection pooling is enabled, this value applies per connection. Default: 10.

Subscription / Trigger​

FieldDescription
Wait for TransferThe router responds to the broker only after the transfer has completed or failed.
Enable Message Duplicate DetectionDiscards an incoming message whose topic, content, quality of service, and retain flag have already been received within the time window before a trigger sees it. Applies per broker connection: If the same topic is subscribed to via two connections, the block does not apply. Since the content is included in the comparison, it also discards genuine duplicates with identical content; therefore, it is disabled by default.
Time Window for DeduplicationThe time span within which an identical message is discarded. Default setting: 3 seconds. Set it short enough so that two messages with different subjects but identical content are not included.

Session Options​

FieldDescription
CleanSessionStarts a new session without saved messages (disable for persistent sessions).
Keep alive (s)Ping interval in seconds.
Timeout (ms)Wait time in milliseconds for reconnection.
tip

Use the MQTT Performance page if you want to optimize QoS, RTT, or connection pooling for throughput and latency.

note

Up to version 5.4, the MQTT implementation could be selected under Expert Settings → Implementation: Legacy Automatic, Legacy Strider Mqtt, Legacy MQTTnet, and the then-recommended MQTTnet. Starting with version 5.5, the OPC Router displays a migration notice for such legacy configurations, recommending a switch to MQTT .NET V2. As of version 5.6, only MQTT .NET V2 is available; the selection option is therefore no longer available.