S2 Trigger

S2 Trigger

Certified

Start a Flow when new S2 records arrive

Polls an S2 stream at a fixed interval and starts one Execution with the new records. The last processed sequence position is saved in the namespace KV store to prevent records from being delivered twice. Use the RealtimeTrigger to start one Execution per record as soon as it arrives.

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

Start a flow when new records are appended to an S2 stream.

yaml
id: s2_polling_trigger
namespace: company.team

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Received {{ trigger.size }} new records"

triggers:
  - id: poll
    type: io.kestra.plugin.s2.Trigger
    accessToken: "{{ secret('S2_ACCESS_TOKEN') }}"
    basin: my-basin
    stream: orders
    interval: PT30S
    maxRecords: 100
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 poll.

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.

DefaultPT1M
Formatduration

Interval

Duration between polls for new records.

Default100

Maximum records

Maximum number of records to process in one polling cycle, between 1 and 1000.

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.

Records

The records returned during this polling cycle.

Definitions
bodystring

Record body

Body of the S2 record.

headersarray
SubTypearray

Record headers

Name value header pairs of the S2 record.

seqNuminteger

Sequence number

Sequence number assigned by S2.

timestampinteger

Timestamp

Timestamp of the record.

Size

Number of records returned.

Tail

Sequence number that will be assigned to the next record on the stream.