Stay organized with collections
Save and categorize content based on your preferences.
This document describes how to create event-driven workflows triggered by state
changes in your Dataflow jobs.
For example, your workflow might:
Send an alert to an on-call engineer if a critical job fails.
Notify users when a batch job completes, or start another
Dataflow job.
Clean up resources used by a job, such as Cloud Storage buckets.
Overview
Eventarc is a Google Cloud service that can
listen to events from other services and route them to various destinations.
When you run a Dataflow job, the job transitions through various
states, such as JOB_STATE_QUEUED, JOB_STATE_RUNNING, and JOB_STATE_DONE.
Dataflow integration with Eventarc lets you trigger an
action when a job changes state.
Because Eventarc is a managed service, you don't need to
provision or manage the underlying infrastructure.
Before you begin
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
To use the Eventarc API, your project must have enough
quota. Also, the service account associated with the
Eventarc trigger must have the appropriate permissions.
Choose an event destination
Choose an event destination to receive the
event. The destination determines the next step in your workflow.
For example:
To send an SMS alert, you might use Cloud Run functions to create a standalone
HTTP trigger.
For a more complex workflow, you might use Workflows.
If your Dataflow pipeline is part of a larger solution that
runs on Google Kubernetes Engine, the trigger can route the event to a GKE
service running in your cluster.
For more information about this style of architecture, see
Event-driven architectures in the
Eventarc documentation.
Create a trigger
To create an Eventarc trigger for Dataflow job
state changes, refer to one of the following documents:
Optionally, you can filter events by Dataflow job ID. For
example, you can select job IDs that match a regular expression. For more
information, see Understand path patterns.
Process events
The event data describes the Dataflow job at the time the event
was triggered. The payload is similar to the
Job resource type,
with the steps, pipeline_description, and transform_name_mapping fields
omitted. Also, depending on the job state, some fields might not be present.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-02 UTC."],[[["\u003cp\u003eThis guide details the process of creating event-driven workflows that are activated by state changes in Dataflow jobs, enabling actions like sending alerts, starting other jobs, or cleaning up resources.\u003c/p\u003e\n"],["\u003cp\u003eEventarc, a managed Google Cloud service, is used to listen for Dataflow job state changes, such as \u003ccode\u003eJOB_STATE_QUEUED\u003c/code\u003e, \u003ccode\u003eJOB_STATE_RUNNING\u003c/code\u003e, or \u003ccode\u003eJOB_STATE_DONE\u003c/code\u003e, and route these events to various destinations without needing infrastructure management.\u003c/p\u003e\n"],["\u003cp\u003eYou can select different event destinations for your workflows, including Cloud Run for sending SMS alerts, Workflows for more complex setups, or Google Kubernetes Engine (GKE) for integrating with services running in your cluster.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating a trigger for Dataflow job state changes, you have the option to filter events by Dataflow job ID, allowing for targeted actions based on specific job identifiers or patterns.\u003c/p\u003e\n"],["\u003cp\u003eThe event data provided contains details about the Dataflow job at the time of the state change, including its ID, project, name, current state, and timestamps, facilitating informed decision-making in your workflow.\u003c/p\u003e\n"]]],[],null,["# Use Eventarc to manage Dataflow jobs\n\nThis document describes how to create event-driven workflows triggered by state\nchanges in your Dataflow jobs.\n\nFor example, your workflow might:\n\n- Send an alert to an on-call engineer if a critical job fails.\n- Notify users when a batch job completes, or start another Dataflow job.\n- Clean up resources used by a job, such as Cloud Storage buckets.\n\nOverview\n--------\n\n[Eventarc](/eventarc/docs) is a Google Cloud service that can\nlisten to events from other services and route them to various destinations.\n\nWhen you run a Dataflow job, the job transitions through various\nstates, such as `JOB_STATE_QUEUED`, `JOB_STATE_RUNNING`, and `JOB_STATE_DONE`.\nDataflow integration with Eventarc lets you trigger an\naction when a job changes state.\n\nBecause Eventarc is a managed service, you don't need to\nprovision or manage the underlying infrastructure.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Eventarc APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=eventarc.googleapis.com,eventarcpublishing.googleapis.com&redirect=https://console.cloud.google.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Eventarc APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=eventarc.googleapis.com,eventarcpublishing.googleapis.com&redirect=https://console.cloud.google.com)\n\n\u003cbr /\u003e\n\nTo use the Eventarc API, your project must have enough\n[quota](/eventarc/docs/quotas). Also, the service account associated with the\nEventarc trigger must have the [appropriate permissions](/eventarc/docs/all-roles-permissions).\n\nChoose an event destination\n---------------------------\n\nChoose an [event destination](/eventarc/docs/overview#targets) to receive the\nevent. The destination determines the next step in your workflow.\n\nFor example:\n\n- To send an SMS alert, you might use Cloud Run functions to create a standalone HTTP trigger.\n- For a more complex workflow, you might use Workflows.\n- If your Dataflow pipeline is part of a larger solution that runs on Google Kubernetes Engine, the trigger can route the event to a GKE service running in your cluster.\n\nFor more information about this style of architecture, see\n[Event-driven architectures](/eventarc/docs/event-driven-architectures) in the\nEventarc documentation.\n\nCreate a trigger\n----------------\n\nTo create an Eventarc trigger for Dataflow job\nstate changes, refer to one of the following documents:\n\n- [Route Dataflow events to Cloud Run](/eventarc/docs/run/route-trigger-dataflow)\n- [Route Dataflow events to Google Kubernetes Engine](/eventarc/docs/gke/route-trigger-dataflow)\n- [Route Dataflow events to Workflows](/eventarc/docs/workflows/route-trigger-dataflow)\n- [Create a trigger for Cloud Run functions](/eventarc/docs/functions/create-triggers)\n\nOptionally, you can filter events by Dataflow job ID. For\nexample, you can select job IDs that match a regular expression. For more\ninformation, see [Understand path patterns](/eventarc/docs/path-patterns).\n\nProcess events\n--------------\n\nThe event data describes the Dataflow job at the time the event\nwas triggered. The payload is similar to the\n[`Job`](/dataflow/docs/reference/rest/v1b3/projects.jobs#Job) resource type,\nwith the `steps`, `pipeline_description`, and `transform_name_mapping` fields\nomitted. Also, depending on the job state, some fields might not be present.\n\nThe following shows an example payload: \n\n {\n \"id\":\"2023-04-13_16_28_37-12345678\",\n \"projectId\":\"my-project\",\n \"name\":\"job1\",\n \"currentState\":\"JOB_STATE_QUEUED\",\n \"currentStateTime\":\"2023-04-13T23:28:37.437622Z\",\n \"createTime\":\"2023-04-13T23:28:37.437622Z\",\n \"location\":\"us-central1\",\n \"startTime\":\"2023-04-13T23:28:37.437622Z\"\n }\n\nFor more information about job states, see the following topics:\n\n- [`JobState`](/dataflow/docs/reference/rest/v1b3/projects.jobs#jobstate)\n- [Life of a Dataflow job](/dataflow/docs/guides/pipeline-workflows#life-of-a-job)\n\nWhat's next\n-----------\n\n- [Design Dataflow pipeline workflows](/dataflow/docs/guides/pipeline-workflows).\n- Read the [Eventarc documentation](/eventarc/docs/overview)."]]