Skip to content

MQTT Input

Subscribes to an MQTT topic and ingests messages. Supports stream and batch modes.

How it works

  1. Connects to the MQTT broker and subscribes to the configured topic.
  2. Stream mode (default): continuously receives messages until shutdown.
  3. Batch mode: drains available messages and exits after idle_timeout_seconds of no new messages.
  4. Namespace convention: mqtt.{topic}.

Configuration

yaml
data_sources:
  source:
    Mqtt:
      broker_url: "mqtt.example.com"
      port: 1883
      topic: "sensors/temperature"
      mode: batch
      idle_timeout_seconds: 10

Configuration variables

VariableDefaultDescription
broker_url(required)MQTT broker hostname
port1883Broker port
topic(required)Topic to subscribe to
client_idauto-generatedMQTT client ID
qos1Quality of Service (0, 1, 2)
username / passwordOptional broker credentials
modestreamstream or batch
idle_timeout_seconds5Batch mode idle timeout
formatjsonData format

Authentication

Authentication depends on the broker. Use username and password when the broker requires credentials, or omit them for local development.

Troubleshooting

SymptomFix
connection refusedVerify the broker URL, port, TLS requirements, and network access from the runner.
no messages arrivingCheck the topic name, QoS, and whether the broker ACLs allow subscriptions for this client.

This site is source-available under PolyForm Shield 1.0.0