New to Kestra?
Use blueprints to kickstart your first workflows.
Push retained MQTT config messages with Kestra so late-joining devices get last-known-good settings on subscribe, with Discord confirmation per push.
A retained MQTT message is the broker's memory: the broker keeps the last retained message per topic and replays it to every new subscriber the moment they connect. This blueprint uses that mechanism for fleet configuration. io.kestra.plugin.mqtt.Publish with retain: true publishes a JSON config document to config/<environment>, so a device that boots three hours after the push still receives the current settings on subscribe, no polling and no config server required. Because the push is a Kestra flow, every config change arrives through a reviewed, versioned, auditable path instead of whoever had broker credentials.
environment is a SELECT that picks the target topic, and log_level plus telemetry_interval_seconds are the settings being rolled out, constrained to valid values by their input types.push_config (io.kestra.plugin.mqtt.Publish) connects to the broker from the MQTT_SERVER secret and publishes the config as a JSON map to config/{{ inputs.environment }} with retain: true and qos: 1. The broker replaces the previously retained message on that topic and delivers the new one to current and future subscribers.schema_version for forward compatibility and execution_id plus pushed_at for provenance, so any device or engineer can trace the active config to the exact execution that produced it.confirm posts the environment, settings, and publish count to Discord.errors block posts a distinct Discord alert on failure, stating explicitly that devices still hold the previous retained config, which is the operationally important fact.Retained messages are powerful and dangerous for the same reason: whatever was published last is what every new device gets, forever. Routing pushes through a Kestra flow means the payload shape is fixed in reviewed YAML, values are constrained by typed inputs, credentials live in secrets, and the execution history is the config changelog. Store the flow in Git with Kestra's version control integration and config changes get pull-request review before they can reach a single device.
username and password properties to the task from secrets.config/<environment> on boot, applying the retained document they receive.MQTT_SERVER: broker URI, e.g. tcp://broker.example.com:1883.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.MQTT_SERVER and DISCORD_WEBHOOK_URL secrets to your Kestra namespace.mosquitto_sub -t config/dev, and confirm it immediately receives the retained document even though it subscribed after the push.from map to your device schema, bumping schema_version when the shape changes.config/{{ inputs.environment }}/sensors for finer-grained rollouts.