MQTT RealtimeTrigger

MQTT RealtimeTrigger

Certified

Trigger flow per MQTT message

Subscribes to MQTT topics and starts one execution immediately for each incoming message. Defaults to JSON payloads with QoS 1 and keeps consuming until stopped or disconnected; use Trigger for scheduled batch pulls instead.

yaml
type: io.kestra.plugin.mqtt.RealtimeTrigger

Consume a message from MQTT topics in real-time.

yaml
id: mqtt_realtime_trigger
namespace: company.team

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ trigger.payload }}"

triggers:
  - id: realtime_trigger
    type: io.kestra.plugin.mqtt.RealtimeTrigger
    server: tcp://localhost:1883
    clientId: kestraProducer
    qos: 1
    topic:
      - kestra/sensors/cpu
      - kestra/sensors/mem
    serdeType: JSON
Properties

Topics to consume

String or list of strings; when multiple topics are provided they are all subscribed.

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

The Authentication Method

A client identifier that is unique on the server being connected to

The connection timeout

CA certificate for TLS connections

Disable ssl verification

DefaultV5
Possible Values
V3V5

The MQTT version to use

The password to use for the connection

Default1

Sets the quality of service for this message

  • Quality of Service 0: indicates that a message should be delivered at most once (zero or one times). The message will not be persisted to disk, and will not be acknowledged across the network. This QoS is the fastest, but should only be used for messages which are not valuable - note that if the server cannot process the message (for example, there is an authorization problem). Also known as "fire and forget".
  • Quality of Service 1: indicates that a message should be delivered at least once (one or more times). The message can only be delivered safely if it can be persisted, so the application must supply a means of persistence using MqttConnectOptions. If a persistence mechanism is not specified, the message will not be delivered in the event of a client failure. The message will be acknowledged across the network.
  • Quality of Service 2: indicates that a message should be delivered once. The message will be persisted to disk, and will be subject to a two-phase acknowledgement across the network. The message can only be delivered safely if it can be persisted, so the application must supply a means of persistence using MqttConnectOptions. If a persistence mechanism is not specified, the message will not be delivered in the event of a client failure. If persistence is not configured, QoS 1 and 2 messages will still be delivered in the event of a network or server problem as the client will hold state in memory. If the MQTT client is shutdown or fails and persistence is not configured then delivery of QoS 1 and 2 messages can not be maintained as client-side state will be lost.
DefaultJSON
Possible Values
STRINGJSONBYTES

Serializer / Deserializer used for the payload

The address of the server to connect to, specified as a URI

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

The user name to use for the connection

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

The MQTT 5 correlation data, Base64-encoded

Echo it back on the reply so the sender can match it to its request. Null for MQTT 3.1.1 and for a message sent without the property.

The message identifier

The message payload

SubTypestring

The MQTT message properties

The quality of service level of the message

The MQTT 5 response topic the sender asked replies to be published to

Null for MQTT 3.1.1 and for a message sent without the property.

Whether the message was retained by the broker

The topic the message was received on