Google Cloud RealtimeTrigger

Google Cloud RealtimeTrigger

Certified

Realtime Pub/Sub trigger

Subscribes to a Pub/Sub subscription and creates one execution per received message. Use the batch Trigger for grouped consumption.

yaml
type: io.kestra.plugin.gcp.pubsub.RealtimeTrigger

Consume a message from a Pub/Sub topic in real-time

yaml
id: realtime_pubsub
namespace: company.team

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

triggers:
  - id: trigger
    type: io.kestra.plugin.gcp.pubsub.RealtimeTrigger
    projectId: test-project-id
    topic: test-topic
    subscription: test-subscription

Use GCP Pub/Sub Realtime Trigger to push events into Firestore

yaml
id: pubsub_realtime_trigger
namespace: company.team

tasks:
  - id: insert_into_firestore
    type: io.kestra.plugin.gcp.firestore.Set
    projectId: test-project-id
    collection: orders
    document:
      order_id: "{{ trigger.data | jq('.order_id') | first }}"
      customer_name: "{{ trigger.data | jq('.customer_name') | first }}"
      customer_email: "{{ trigger.data | jq('.customer_email') | first }}"
      product_id: "{{ trigger.data | jq('.product_id') | first }}"
      price: "{{ trigger.data | jq('.price') | first }}"
      quantity: "{{ trigger.data | jq('.quantity') | first }}"
      total: "{{ trigger.data | jq('.total') | first }}"

triggers:
  - id: realtime_trigger
    type: io.kestra.plugin.gcp.pubsub.RealtimeTrigger
    projectId: test-project-id
    topic: orders
    subscription: kestra-subscription
    serdeType: JSON
Properties

The Pub/Sub topic

The Pub/Sub topic. It must be created before executing the task.

Defaultfalse

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

Defaulttrue

Auto-create subscription

Create the subscription if missing; default true

The GCP service account to impersonate

DefaultPT1M

How often the trigger checks for new messages

Max duration

Optional run duration limit (ISO-8601)

Max records

Optional cap on messages before stopping

The GCP project ID

SubTypestring
Default["https://www.googleapis.com/auth/cloud-platform"]

The GCP scopes to be used

DefaultSTRING
Possible Values
STRINGJSON

Serde type

Serializer/deserializer for messages; defaults to STRING

The GCP service account

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

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

Subscription

Subscription name; auto-created when autoCreateSubscription is true

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 attributes map

The message data, must be a string if serde type is 'STRING', otherwise a JSON object

If it's a string, it can be a dynamic property otherwise not.

The message identifier

The message ordering key