Alibaba Cloud RealtimeTrigger

Alibaba Cloud RealtimeTrigger

Certified

Trigger a flow for each MNS queue message

Long-polls an MNS queue and starts one execution per message, with the message body available as trigger.data. It only polls when executions are requested, and deletes the messages of a poll once Kestra has taken them and requests more, so a stop or kill never deletes a message that was not handed over. Use Trigger to process messages in batches.

yaml
type: io.kestra.plugin.alibaba.mns.RealtimeTrigger

Log each order as it arrives

yaml
id: mns_realtime
namespace: company.team

triggers:
  - id: on_message
    type: io.kestra.plugin.alibaba.mns.RealtimeTrigger
    accessKeyId: "{{ secret('ALIBABA_ACCESS_KEY_ID') }}"
    accessKeySecret: "{{ secret('ALIBABA_ACCESS_KEY_SECRET') }}"
    region: cn-hangzhou
    accountId: "{{ secret('ALIBABA_ACCOUNT_ID') }}"
    queue: orders
    serdeType: JSON

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Order {{ trigger.data.orderId }}"
Properties

AccessKey ID

The AccessKey ID used to authenticate against Alibaba Cloud.

AccessKey secret

The AccessKey secret paired with the AccessKey ID.

Queue

The name of the MNS queue.

Account ID

The Alibaba Cloud account ID, used to derive the default endpoint https://<accountId>.mns.<region>.aliyuncs.com. Not needed when endpointOverride is set.

Defaultfalse

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

Defaulttrue

Auto-delete

Delete messages from the queue once they are handed to Kestra: Trigger deletes them once the ION file is stored, RealtimeTrigger once Kestra has taken them and requests more messages. When false, they become visible again after the queue's visibility timeout.

Default16

Batch size

Maximum number of messages fetched per request, from 1 to 16, 16 by default. Each message still starts its own execution.

Endpoint override

Custom http or https endpoint URL. When set, it takes precedence over the endpoint derived from region.

Region

The Alibaba Cloud region ID, for example cn-hangzhou. The service endpoint is derived from it unless endpointOverride is set.

Security token

Optional Security Token Service (STS) token, required when using temporary credentials.

DefaultSTRING
Possible Values
STRINGJSON

Serde type

STRING keeps message bodies as text, JSON parses them. A body that is not valid JSON is kept as a string and logged.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

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

DefaultPT20S

Wait time

How long each long-poll request waits for messages, from 1 to 30 seconds, 20 seconds by default.

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 message body

Text with serdeType: STRING, or the parsed value with serdeType: JSON (kept as text when it is not valid JSON).

MNS message ID