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.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
clean_session | boolean | no | false | (Consumer only) If true, start with a clean session. Defaults to false (persistent session). Setting this to true effectively enables Subscriber mode (ephemeral). |
client_id | string | no | — | Optional client ID. If not provided, one is generated or derived from route name. |
delayed_ack | boolean | no | false | (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_seconds | integer | no | — | Keep-alive interval in seconds. Defaults to 20. |
max_inflight | integer | no | — | Maximum number of inflight messages. |
password | string | no | — | Optional password for authentication. |
protocol | v5 | v3 | no | v5 | MQTT protocol version (V3 or V5). Defaults to V5. |
qos | integer | no | — | Quality of Service level (0, 1, or 2). Defaults to 1. |
queue_capacity | integer | no | — | Capacity of the internal channel for incoming messages. Defaults to 100. |
session_expiry_interval | integer | no | — | Session expiry interval in seconds (MQTT v5 only). |
tls | object | no | see below | TLS configuration. |
topic | string | no | — | The MQTT topic. |
url | string | yes | — | MQTT broker URL (e.g., “tcp://localhost:1883”). Does not support multiple hosts. If it contains userinfo, it will be treated as a secret. |
username | string | no | — | Optional 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()
};
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
accept_invalid_certs | boolean | no | false | If true, disable server certificate verification (insecure). |
ca_file | string | no | — | Path to the CA certificate file. |
cert_file | string | no | — | Path to the client certificate file (PEM). |
cert_password | string | no | — | Password for the private key (if encrypted). |
key_file | string | no | — | Path to the client private key file (PEM). |
required | boolean | no | false | If true, enable TLS/SSL. |