Skip to main content
Version: 0.6.x
input/mqttINPUTBUFFERPROCESSOROUTPUT

MQTT

The MQTT input connects to an MQTT broker, subscribes to one or more topics, and receives real-time messages. As a channel-based input it follows the engine's cancellation-safety contract: dropping a pending read never loses an already-decoded message (see Input Delivery Semantics).

Configuration​

FieldTypeRequiredDefaultDescription
typestringyes—Constant value "mqtt"
hoststringyes—MQTT broker address
portintegeryes—MQTT broker port
client_idstringyes—Unique client identifier
topicsarray<string>yes—List of topics to subscribe to (wildcards supported)
usernamestringno—Authentication username
passwordstringno—Authentication password
qosintegerno—QoS level (0, 1, 2)
clean_sessionbooleanno—Whether to use a clean session
keep_aliveintegerno—Keep-alive interval (seconds)

TLS​

Set the tls block to connect over TLS (MQTT over port 8883):

input:
type: "mqtt"
host: "localhost"
port: 8883
client_id: "tls-client"
topics: ["demo"]
tls:
enabled: true
ca: "/etc/arkflow/certs/ca.pem"

enabled defaults to true when the block is present (set enabled: false to keep the block as documentation); ca verifies the broker certificate; client_cert/client_key enable mTLS and must be configured together. ca is optional with mTLS: without it the broker is verified against the platform trust store (e.g. public brokers with system-issued certificates). client_cert without client_key (or vice versa) is a configuration error. Omitting the tls block keeps plain TCP. The client_id must be unique per connection.

Examples​

input:
type: "mqtt"
host: "localhost"
port: 1883
client_id: "my_client"
username: "user"
password: "pass"
topics:
- "sensors/temperature"
- "sensors/humidity"
qos: 1
clean_session: true
keep_alive: 60