
S2 RealtimeTrigger
CertifiedStart a Flow for each S2 record
S2 RealtimeTrigger
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.
type: io.kestra.plugin.s2.RealtimeTriggerExamples
Start a flow for each record appended to an S2 stream.
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
accessToken *string
S2 access token
Access token used to authenticate with S2
basin *string
S2 basin
S2 basin containing the stream
stream *string
Stream
Name of the S2 stream to listen to.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
basinEndpoint string
https://{basin}.b.s2.dev/v1Basin 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.
seqNum integerstring
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.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
tailOffset integerstring
Initial tail offset
Initial position: start this many records before the tail of the stream. Only used until the trigger has delivered a record.
timestamp integerstring
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.
when string
trueA 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.
Outputs
body string
Record body
Body of the S2 record.
headers array
Record headers
Name value header pairs of the S2 record.
seqNum integer
Sequence number
Sequence number assigned by S2 to the record.
timestamp integer
Timestamp
Timestamp of the record.