Redis Stream Trigger

Redis Stream Trigger

Certified

Start an execution for new entries of a Redis stream consumer group

Periodically reads one batch of new entries with XREADGROUP as consumer inside group, using the same contract as ReadGroup, and starts one execution when the batch is not empty. The execution gets the stream name, the exact stream IDs and the field-value maps of the entries as trigger.ids, trigger.messages or trigger.uri, depending on fetchType. The group must already exist: create it once with GroupCreate.

The trigger never acknowledges anything. Delivery is at-least-once: the entries of a batch are pending for consumer as soon as they are read, and stay so until the flow runs Ack with {{ trigger.ids }} after the business step. When the execution fails before that, the entries are not read again by this trigger, because it only asks for new entries. Recover them with a flow that runs Claim. Handlers must be idempotent, because a failure between a business write and the acknowledgement replays the entry.

Every evaluation is a single read that returns immediately, so a quiet stream costs one command per interval and never holds a scheduler thread. Use a stable consumer name for the trigger and a different one for any other reader of the same group. Killing the trigger closes the connection of a read in flight and starts no execution.

yaml
type: io.kestra.plugin.redis.stream.Trigger

Start an execution for each batch of new orders, process it and acknowledge it.

yaml
id: redis_stream_listen
namespace: company.team

tasks:
  - id: process
    type: io.kestra.plugin.core.log.Log
    message: "handling {{ trigger.count }} entries: {{ trigger.messages }}"

  - id: acknowledge
    type: io.kestra.plugin.redis.stream.Ack
    url: "{{ secret('REDIS_URI') }}"
    key: orders
    group: billing
    ids: "{{ trigger.ids }}"

triggers:
  - id: watch
    type: io.kestra.plugin.redis.stream.Trigger
    url: "{{ secret('REDIS_URI') }}"
    key: orders
    group: billing
    consumer: billing_trigger
    count: 50
    interval: PT30S

Keep large batches out of the execution by storing them, and still acknowledge by ID.

yaml
id: redis_stream_listen_store
namespace: company.team

tasks:
  - id: acknowledge
    type: io.kestra.plugin.redis.stream.Ack
    url: "{{ secret('REDIS_URI') }}"
    key: orders
    group: billing
    ids: "{{ trigger.ids }}"

triggers:
  - id: watch
    type: io.kestra.plugin.redis.stream.Trigger
    url: "{{ secret('REDIS_URI') }}"
    key: orders
    group: billing
    consumer: billing_trigger
    fetchType: STORE
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-redis --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.

Properties

Consumer name inside the group

Rendered consumer name. Entries read by the trigger are pending for this consumer until they are acknowledged. Use a stable name that no other reader of the group uses.

Consumer group name

Rendered group name; the group must already exist, so create it with GroupCreate first.

Redis stream key

Rendered key passed to XREADGROUP.

Redis connection string

Defaultfalse

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

Default100

Maximum entries per evaluation

Defaults to 100 and maps to COUNT. Must be between 1 and 1000. Forced to 1 when fetchType is FETCH_ONE, so no entry is marked as delivered without its ID reaching the execution.

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

How entries are passed to the execution

Defaults to FETCH, which puts every entry of the batch in trigger.messages. FETCH_ONE passes a single entry in trigger.message. STORE writes the batch as an ION file and passes its trigger.uri, which keeps large payloads out of the execution. NONE passes no entry body. trigger.ids and trigger.count are always set, so the batch can be acknowledged in every mode.

DefaultPT1M
Formatduration

Interval between polling.

The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

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

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.

Consumer name the entries are now pending for

Number of entries delivered by this read

Consumer group that was read

SubTypestring

Exact stream IDs delivered by this read

In delivery order, ready to be passed to Ack. Populated for every fetchType.

Single entry delivered by this read

Only set when fetchType is FETCH_ONE; null when the read returned nothing.

Definitions
fieldsobject
SubTypestring

Field-value map of the entry

Returned exactly as stored in Redis, with no serialization format applied.

idstring

Exact stream ID of the entry

Pass it to Ack to remove the entry from the group's pending list.

streamstring

Stream the entry was read from

Entries delivered by this read

Only set when fetchType is FETCH.

Definitions
fieldsobject
SubTypestring

Field-value map of the entry

Returned exactly as stored in Redis, with no serialization format applied.

idstring

Exact stream ID of the entry

Pass it to Ack to remove the entry from the group's pending list.

streamstring

Stream the entry was read from

Stream that was read

Formaturi

URI of the ION file holding the entries

Only set when fetchType is STORE.