Docs / Contact / connectors/mqtt
MQTT Connector
Direction: Write Only | Type: mqtt
Publish messages to MQTT brokers with support for TLS/SSL, authentication, and Quality of Service levels.
Operations
| Operation | Direction | Description |
|---|---|---|
publish |
Write | Publish a message to an MQTT topic |
Connector Configuration
| Field | Required | Default | Description |
|---|---|---|---|
| Broker URL | Yes | - | MQTT broker address (mqtt:// or mqtts:// for TLS) |
| Client ID | No | Auto | MQTT client identifier |
| Username | No | - | Broker username |
| Password | No | - | Broker password |
| Keepalive | No | 60 |
Keepalive interval in seconds |
| Clean Session | No | true |
Start with a clean session |
| TLS | No | - | TLS/SSL configuration (see below) |
| Topic | No | - | Default publish topic (can be overridden per operation) |
| QoS | No | 0 |
Default Quality of Service level |
| Timeout | No | 30 |
Connection timeout in seconds |
| Retain | No | false |
Retain messages on the broker |
TLS/SSL Configuration
For brokers that require encrypted connections (mqtts://):
json
{
"tls": {
"enabled": true,
"ca_certs": "/path/to/ca-cert.pem",
"certfile": "/path/to/client-cert.pem",
"keyfile": "/path/to/client-key.pem",
"cert_reqs": "required",
"tls_version": "tlsv1.2"
}
}
| Field | Default | Options |
|---|---|---|
| enabled | false |
Enable TLS/SSL |
| ca_certs | - | CA certificate file for server validation |
| certfile | - | Client certificate for mutual TLS |
| keyfile | - | Client private key for mutual TLS |
| cert_reqs | required |
none, optional, required |
| tls_version | tlsv1.2 |
tlsv1.1, tlsv1.2, tlsv1.3 |
Quality of Service (QoS)
| Level | Delivery | Description |
|---|---|---|
| 0 | At most once | Fire and forget: fastest, no acknowledgment |
| 1 | At least once | Broker acknowledges receipt; may deliver duplicates |
| 2 | Exactly once | Four-step handshake guarantees single delivery (slowest) |
Per-Operation Configuration
When using an MQTT connector in a flow node:
| Field | Required | Description |
|---|---|---|
| Topic | Yes | MQTT topic to publish to (supports Jinja2) |
| QoS | No | Override connector default QoS |
| Retain | No | Override connector default retain flag |
| Payload | No | Message payload (defaults to event payload as JSON) |
| Timeout | No | Override connector default timeout |
Output
The full event payload is published to the configured topic as the message body. The flow step records the standardized result:
json
{
"status": "completed",
"data": {
"status": "published",
"broker": "mqtts://broker.example.com:8883",
"topic": "events/device-42/telemetry",
"client_id": "contact-publisher",
"qos": 1,
"retain": false,
"bytes": 64
}
}
On a connection or publish failure the step is recorded with status error and the broker error message; it is never reported as a success when delivery did not happen.
Example
Connector Setup:
json
{
"broker_url": "mqtts://broker.example.com:8883",
"username": "${secrets.mqtt_user}",
"password": "${secrets.mqtt_pass}",
"tls": { "enabled": true, "cert_reqs": "required" },
"qos": 1
}
Operation:
- Topic:
events/{{ payload.device_id }}/{{ payload.event_type }} - QoS:
2 - Payload:
{{ payload | tojson }}
Tendrl