Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MQTT

Schemes: mqtt://, mqtts://

Query parameters recognised as config fields for this connector. The object-typed tls is set with a JSON literal, e.g. ?tls={...}. Unrecognised parameters are not forwarded as driver options, so any other ?key=value pair is rejected rather than silently ignored.

NameTypeRequiredDefaultDescription
clean_sessionbooleannofalse(Consumer only) If true, start with a clean session. Defaults to false (persistent session). Setting this to true effectively enables Subscriber mode (ephemeral).
client_idstringnoOptional client ID. If not provided, one is generated or derived from route name.
delayed_ackbooleannofalse(Consumer only) If true, messages are acknowledged immediately upon receipt (auto-ack). If false (default), messages are acknowledged after processing (manual-ack). Note: For QoS 1/2 the publisher always waits for end-to-end broker confirmation (PUBACK/PUBCOMP) before reporting success, independent of this setting; QoS 0 remains fire-and-forget.
keep_alive_secondsintegernoKeep-alive interval in seconds. Defaults to 20.
max_inflightintegernoMaximum number of inflight messages.
passwordstringnoOptional password for authentication.
protocolv5 | v3nov5MQTT protocol version (V3 or V5). Defaults to V5.
qosintegernoQuality of Service level (0, 1, or 2). Defaults to 1.
queue_capacityintegernoCapacity of the internal channel for incoming messages. Defaults to 100.
session_expiry_intervalintegernoSession expiry interval in seconds (MQTT v5 only).
tlsobjectnosee belowTLS configuration.
topicstringnoThe MQTT topic.
urlstringyesMQTT broker URL (e.g., “tcp://localhost:1883”). Does not support multiple hosts. If it contains userinfo, it will be treated as a secret.
usernamestringnoOptional username for authentication.

Struct-typed fields

tls

TLS configuration for secure connections.

Configures Transport Layer Security (TLS/SSL) for encrypted communication. Supports both client certificate (mutual TLS) and server certificate validation.

Examples

use mq_bridge::models::TlsConfig;

let tls = TlsConfig {
    required: true,
    ca_file: Some("/path/to/ca.pem".to_string()),
    cert_file: Some("/path/to/cert.pem".to_string()),
    key_file: Some("/path/to/key.pem".to_string()),
    ..Default::default()
};
NameTypeRequiredDefaultDescription
accept_invalid_certsbooleannofalseIf true, disable server certificate verification (insecure).
ca_filestringnoPath to the CA certificate file.
cert_filestringnoPath to the client certificate file (PEM).
cert_passwordstringnoPassword for the private key (if encrypted).
key_filestringnoPath to the client private key file (PEM).
requiredbooleannofalseIf true, enable TLS/SSL.