S2 RealtimeTrigger

S2 RealtimeTrigger

Certified

Start a Flow for each S2 record

Opens a long-lived Server-Sent Events (SSE) read session on an S2 stream and starts one Execution per record. The last delivered sequence number is saved in the namespace KV store after each batch, so after a restart reading resumes right after the last delivered record without re-firing it. Use seqNum, timestamp, or tailOffset to choose the initial position; only one of them can be set and it is only used until the trigger has delivered a record. When none is set, the initial position is the tail of the stream and only records appended after the session opens are emitted. Prefer the polling Trigger for interval-based reads.

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

Start a flow for each record appended to an S2 stream.

yaml
id: s2_realtime_trigger
namespace: company.team

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

triggers:
  - id: realtime_trigger
    type: io.kestra.plugin.s2.RealtimeTrigger
    accessToken: "{{ secret('S2_ACCESS_TOKEN') }}"
    basin: my-basin
    stream: orders
Properties

S2 access token

Access token used to authenticate with S2

S2 basin

S2 basin containing the stream

Stream

Name of the S2 stream to listen to.

Defaultfalse

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

Defaulthttps://{basin}.b.s2.dev/v1

Basin endpoint

S2 basin API endpoint. The {basin} placeholder is replaced by the basin name. When the endpoint has no placeholder, the basin is sent in the S2-Basin header, which is how a custom endpoint such as s2-lite is addressed.

Initial sequence number

Initial position: start from the first record whose sequence number is greater than or equal to this value. Only used until the trigger has delivered a record.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

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

Initial tail offset

Initial position: start this many records before the tail of the stream. Only used until the trigger has delivered a record.

Initial timestamp

Initial position: start from the first record whose timestamp is greater than or equal to this value. Only used until the trigger has delivered a record.

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.

Record body

Body of the S2 record.

SubTypearray

Record headers

Name value header pairs of the S2 record.

Sequence number

Sequence number assigned by S2 to the record.

Timestamp

Timestamp of the record.