New to Kestra?
Use blueprints to kickstart your first workflows.
Batch-drain an MQTT telemetry topic with Kestra. Collect up to 500 messages or 30 seconds per run, store the batch as a file, and post a Slack digest.
Streaming telemetry does not have to mean streaming infrastructure. This blueprint runs io.kestra.plugin.mqtt.Subscribe on a 15-minute schedule against telemetry/#: each run connects, collects messages until it hits 500 records or 30 seconds of listening, writes the batch to a file in Kestra's internal storage, and posts the collected count to Slack. The result is micro-batching over MQTT with two explicit bounds, so every execution finishes quickly and every batch is a durable, downloadable artifact ready for a downstream load.
collect_telemetry (io.kestra.plugin.mqtt.Subscribe) connects to the broker from the MQTT_SERVER secret and subscribes to the telemetry/# wildcard, matching every device and metric under the telemetry namespace.maxRecords: 500 caps the batch size, and maxDuration: PT30S caps the listening window. Whichever fires first ends the task, so a quiet topic never blocks the execution and a busy one never produces an unbounded batch.{{ outputs.collect_telemetry.uri }}, with {{ outputs.collect_telemetry.messagesCount }} carrying the batch size. Each stored message includes its topic, payload, QoS, and retain flag.notify posts the count to Slack; the errors block posts a distinct alert when a window fails, so a telemetry gap is a message, not a surprise.Schedule trigger runs the collection every 15 minutes.A bare MQTT consumer script needs a process supervisor, its own batching logic, somewhere durable to write, and monitoring on top. Kestra collapses all of that: the Subscribe task is the batching logic, internal storage is the durable sink, the schedule is the supervisor, and every window is an execution with logs, outputs, and history. Changing the cadence or the bounds is a one-line YAML edit.
telemetry/#, or adjust the topic filter. Public test brokers accept anonymous connections; for authenticated brokers, add the username and password properties from secrets.MQTT_SERVER: broker URI, e.g. tcp://broker.example.com:1883.SLACK_WEBHOOK_URL: Slack incoming webhook URL.MQTT_SERVER and SLACK_WEBHOOK_URL secrets to your Kestra namespace.mosquitto_pub -t telemetry/dev-001/temp -m '{"value": 21.4}', then execute the flow within 30 seconds.disabled: false on the every_15_minutes trigger.{{ outputs.collect_telemetry.uri }} into a downstream task to load each batch into DuckDB, Postgres, or object storage.maxRecords and maxDuration to your traffic: tighter bounds mean fresher data, looser bounds mean fewer executions.telemetry/+/temperature and another for telemetry/+/vibration.