Eventarc in Google Cloud: Making Your Systems React the Moment Something Happens
A complete, plain-English guide to Eventarc, the Google Cloud service that collects events from many sources and routes them to the right destinations, covering triggers, buses, pipelines, delivery guarantees, security, reliability and the habits of well-built event-driven systems.
Picture the emergency dispatch center of a large city. Calls arrive all day: a fire in one street, a traffic accident in another, a medical emergency in a third. The dispatcher does not fix any of these problems personally. Instead, the dispatcher reads each call, decides what kind of event it is, and sends the right responder to the right place within seconds. Nobody has to keep phoning the fire station to ask whether anything is burning. Eventarc is the dispatch center for your cloud. When something happens, such as a file being uploaded, a virtual machine being created or a message arriving, Eventarc notices and sends a notice to whichever application should react.
1What Eventarc Is and Why It Exists
Eventarc is a managed Google Cloud service that delivers events from sources to destinations so that applications can react instead of constantly checking.
The simple definition
Eventarc is a fully managed service for building event-driven applications. An event is a small record that says “this thing happened”, such as “a file named photo.jpg was added to this storage bucket”. Eventarc receives events from many places, including Google Cloud services, your own applications and some outside software providers. It then filters those events and delivers the matching ones to a destination, such as a Cloud Run service, a Cloud Run function, a Workflows execution or a web address inside your network. Eventarc delivers events in a standard format called CloudEvents, so every destination sees the same kind of envelope.
The problem it solves
Before event-driven design, applications often relied on polling. A program would wake up every minute and ask, “Is there a new file? Is there a new order? Has anything changed?” Most of the time the answer was no, so the work was wasted, and when the answer was yes, the program might notice it a minute late. Polling also tangles systems together, because the checking program must know where and how to look. Event-driven design flips this around. The thing that changes announces the change, and interested programs listen. Eventarc provides the listening, filtering and delivery so that you do not have to build and operate that plumbing yourself.
Polling is like walking to the mailbox every ten minutes to see whether a letter has arrived. Event-driven design is like a doorbell that rings only when a visitor appears. Eventarc is the doorbell system, the wiring and the person who decides which family member should answer.
Where it is used
Teams use Eventarc to process uploaded images, start data pipelines when new files land, react to infrastructure changes for security automation, update search indexes when records change, send notifications, and connect separate microservices without tight coupling. Because it is managed, there are no brokers to install and no servers to patch.
2Event-Driven Thinking: Producers, Routers and Consumers
Before the details of Eventarc, it helps to understand the simple three-part pattern behind every event-driven system.
The three roles
Producer
The thing in which something happens. It could be a storage bucket receiving a file, a database changing a record, or your own application finishing a job. The producer announces the fact and moves on.
Router
The middle layer that receives announcements, checks them against rules and forwards them to the right place. Eventarc plays this role.
Consumer
The program that reacts. It might resize an image, send an email, start a workflow or update a record. It does its job and does not need to know who produced the event.
Why this separation is powerful
The producer does not know who is listening, and the consumer does not know who produced the event. This is called loose coupling. You can add a new consumer without changing the producer at all. You can replace a consumer with a better one without telling anyone. If one consumer is slow or broken, the producer is not stuck waiting. This freedom is the main reason teams choose event-driven design for growing systems.
A newspaper does not know who its readers are and does not wait for each reader to finish before printing the next edition. Readers choose what to read and when. The delivery service between them is the router. Producers, routers and consumers work independently, which keeps the whole system flexible.
Two styles of working together
Choreography
Each service reacts to events on its own and may produce new events. There is no central boss. It is flexible and scales well, but the overall story can be harder to see.
Orchestration
A central coordinator tells each service what to do and in which order, such as a workflow that runs several steps. It is easier to follow and debug, but the coordinator becomes a central piece to maintain.
Eventarc works well with both styles. Use it to trigger simple reactions directly, and use it to start a workflow when a multi-step process with clear ordering and error handling is needed.
3Where Eventarc Fits Among Other Google Cloud Services
Several Google Cloud services seem to overlap with Eventarc. Each has a different main job.
Eventarc
Routes events from many sources to many kinds of destinations, with filtering and a standard event format.
Pub/Sub
A general messaging and streaming service. It carries messages between systems at very large scale. Eventarc Standard uses it behind the scenes for transport.
Cloud Scheduler
Starts things on a schedule, like a cron job. Use it when the trigger is the clock, not an event.
Workflows
Coordinates a series of steps and services with branching, waiting and error handling. Often a destination for Eventarc.
Cloud Tasks
Manages queues of individual tasks to be run with controlled rate and retries, usually created by your own code.
Cloud Run and Cloud Run functions
Run your code. They are the most common places where events end up and get handled.
Think of a post office. Pub/Sub is the national mail network that carries all kinds of parcels. Cloud Scheduler is the alarm clock that says “send the monthly bill now”. Workflows is the manager who follows a checklist. Eventarc is the sorting desk that reads each notice and decides which department should receive it.
A simple way to choose
| Your need | Best fit | Why |
|---|---|---|
| React when a file arrives in a bucket | Eventarc | Built-in event source and filtering |
| React when someone changes a firewall rule | Eventarc with audit log events | Audit logs record the change and Eventarc routes it |
| Stream millions of messages between systems | Pub/Sub | Designed for high-volume messaging |
| Run something every night at two | Cloud Scheduler | Time-based trigger |
| Run several steps in order with retries | Workflows, possibly started by Eventarc | Orchestration with clear state |
4Core Concepts and Vocabulary
A dozen words explain almost everything you will see in the Eventarc console and documentation.
Event
A record that something happened, with details such as what happened, where, when and a payload of data about it.
Event provider
A source of events, such as Cloud Storage, Cloud Audit Logs, Pub/Sub, or an outside partner.
Event type
A name that describes the kind of event, such as an object being finalized in storage or a message being published.
Event destination
The place that receives and handles the event, such as a Cloud Run service or a workflow.
Trigger
In Eventarc Standard, a rule that connects event filters to one destination.
Message bus
In Eventarc Advanced, a central channel that collects events from sources so that they can be routed to many destinations.
Enrollment
In Eventarc Advanced, a rule that subscribes a pipeline to a bus by matching events with a condition.
Pipeline
In Eventarc Advanced, the path from a matched event to a destination, which may include a change to the event on the way.
CloudEvents
An open standard that describes the common envelope in which events are delivered.
Filter
A condition on event details that decides which events a trigger or enrollment accepts.
Service account
The identity that Eventarc uses to receive events and to call the destination safely.
Idempotent handler
A consumer written so that handling the same event twice has the same result as handling it once.
In the dispatch center, an event is a phone call, the provider is the neighborhood it came from, the type is “fire” or “accident”, the filter is the dispatcher’s rule for sending fire calls to the fire station, and the destination is the responder who goes to the scene.
5CloudEvents: The Shared Envelope
Every event delivered by Eventarc arrives in the same standard shape, which makes consumers simpler to write.
What CloudEvents is
CloudEvents is an open specification, maintained by the Cloud Native Computing Foundation, for describing events in a common way. Before such a standard, every service described its events differently, so consumers needed special code for each source. With a standard envelope, a consumer can read the same basic fields from every event and then look inside the data part for details that depend on the source.
The main attributes
id
A unique identifier for this event from this source. It is vital for spotting duplicates.
source
Says where the event came from, such as the name of a bucket or a topic.
type
Describes what kind of event it is, using a name that identifies the provider and the action.
specversion
The version of the CloudEvents standard that the event follows.
subject
Narrows down what the event is about, such as the name of one file inside a bucket.
time
When the event was produced, useful for ordering and for measuring delay.
datacontenttype and data
Describe the format of the payload and carry the actual details, such as the file’s size and name.
A parcel from any shop arrives in a box with a label showing sender, type of contents, date and a tracking number, whatever is inside. CloudEvents is that label. The inside of the box differs, but the label always has the same fields in the same places.
Use the event id together with the source to detect duplicates, and write your handler to read the standard attributes first. Only then look inside the data for provider-specific details.
Writing a consumer that reads only the data part and ignores the standard attributes. You lose important context such as the event type and subject, and you make the consumer harder to reuse for other sources.
6Event Providers: Where Events Come From
Eventarc can receive events from several kinds of sources, and the choice affects speed, detail and setup.
Direct events from Google Cloud services
Some Google Cloud services publish events straight to Eventarc, for example when a file is created or changed in Cloud Storage. These are usually the quickest and simplest to use because the service itself says what happened.
Cloud Audit Logs events
Google Cloud records many actions in audit logs. Eventarc can turn matching audit log entries into events. This opens up a very large set of sources, because nearly any action on a Google Cloud service can appear in an audit log. The trade-off is that events arrive through the logging system and may be slightly slower, and some data-related actions need extra audit logging to be switched on.
Pub/Sub messages
Messages published to a Pub/Sub topic can trigger a destination. This is helpful when your own applications already publish messages, and you want them delivered in the standard event format.
Third-party providers
Some outside software providers can send events into Eventarc, allowing you to react to changes in tools that are not part of Google Cloud. The exact list of partners can change, so check the current documentation.
Your own applications
With Eventarc Advanced, your applications can publish custom events directly to a message bus. This turns Eventarc into the event backbone of your own systems.
A newsroom gets stories from reporters who call in directly, from official records that are published later, from other newspapers and from the public. Eventarc similarly accepts events from direct callers, from the audit record, from messaging channels, from partners and from your own apps.
Direct events versus audit log events
Direct events
- Usually faster and simpler
- Clear, purpose-built event types
- No need to enable extra audit logging
- Limited to services that publish them
Audit log events
- Cover a very wide range of services and actions
- Useful for security and governance automation
- May need data access logs enabled, with cost
- Slightly more delay and more complex filters
Prefer a direct event when one exists for your use case. Use audit log events when no direct event exists, or when you specifically want to react to administrative actions such as someone changing a policy.
7Destinations: Where Events Are Delivered
An event is useful only when something handles it. Eventarc supports several kinds of destinations.
Cloud Run services
Your container receives the event as a web request. This is the most flexible option and works with any language that can serve web requests.
Cloud Run functions
Small functions written for event handling, where the platform wraps your code so you write only the logic.
Workflows
An event starts a workflow execution, and the event data becomes the input of that run.
Google Kubernetes Engine
Events can be delivered to services running in a GKE cluster, for teams that already run workloads on Kubernetes.
Internal HTTP endpoints
Events can be delivered to private web addresses inside your virtual network, using private connectivity so traffic does not cross the public internet.
Other buses and topics
With Eventarc Advanced, events can also be forwarded to other targets such as a Pub/Sub topic or another bus, chaining event flows together.
A switchboard can connect a caller to a person at a desk, to a department with a manager who follows a script, to a team in another building or to a private line inside the company. Eventarc destinations are those different kinds of receivers.
How a destination should behave
Accept the event quickly
The destination receives the event as an HTTP request. It should do its work, or hand it to a safe queue, and respond within the allowed time.
Return a success code only after it is safe
A successful response tells Eventarc the event was handled. If the destination replies with an error, Eventarc treats the event as not delivered and retries.
Be ready for repeats
The same event may arrive more than once, so the handler must be safe to run again without causing double effects.
8Eventarc Standard: Triggers
The classic way to use Eventarc is to create a trigger that connects some events to one destination.
What a trigger holds
A trigger is a small configuration object with a few essential parts. It says which events to accept by describing event filters, which destination to deliver them to, which identity to use when calling the destination, and in which location the trigger lives. Once created, the trigger works continuously with no servers for you to run. Behind the scenes, Eventarc Standard uses Pub/Sub as its transport layer, creating and managing the needed topic and subscription for you.
Event filters
Conditions on attributes such as the type of event and the source or resource involved. Only matching events are delivered.
Destination
Exactly one place to deliver to, such as a particular Cloud Run service and path.
Service account
The identity used to call the destination, which must be allowed to receive events and to invoke the destination.
Location
Where the trigger lives. For many sources it must match the location of the resource producing the events.
A trigger is a standing instruction to the dispatcher: “Whenever a call matching this description arrives, send this team, using this official badge, from this station.” Once the instruction is given, the dispatcher follows it every time without being reminded.
One destination per trigger
A Standard trigger sends matching events to a single destination. If several services need the same event, you create several triggers, one for each destination, each with its own filter. This is simple and clear, but it can mean many triggers in a large system. The advanced edition, described next, offers a more scalable way to fan out.
Creating a trigger in a different location from the event source, and then wondering why no events arrive. Check the location rules for your provider and make sure the trigger and the resource match.
Use a dedicated service account for each trigger or group of related triggers, with only the roles it needs. This keeps permissions narrow and makes audit records easy to read.
9Eventarc Advanced: Buses, Enrollments and Pipelines
The advanced edition adds a central bus so that many sources and many destinations can be connected in a flexible way.
The three building blocks
Message bus
A bus is a central channel in a location. Events from Google Cloud sources and from your own applications are sent to the bus. It acts like a main street where all event traffic travels.
Enrollment
An enrollment connects a bus to a pipeline. It contains a match condition, written as an expression, that decides which events from the bus go into the pipeline. Many enrollments can exist on one bus, each interested in different events.
Pipeline
A pipeline defines where matching events go and what happens to them on the way. It names a destination, and it can include steps that change the shape of the event before delivery.
flowchart LR
S1["Google Cloud sources"] --> BUS["Message bus"]
S2["Your own applications"] --> BUS
BUS --> E1["Enrollment: image uploads"]
BUS --> E2["Enrollment: security changes"]
BUS --> E3["Enrollment: order events"]
E1 --> P1["Pipeline to image service"]
E2 --> P2["Pipeline to workflow"]
E3 --> P3["Pipeline to Pub/Sub topic"]
A railway station has many incoming trains, which are the sources. The station is the bus. Each platform sign says “all trains to the coast go here”, which is an enrollment. Each platform leads to a specific line, which is a pipeline, possibly with a stop where the cargo is repacked on the way.
What the advanced edition adds
Benefits
- Many destinations can receive the same event through separate enrollments
- Your own applications can publish custom events to a bus
- Events can be changed on the way to fit what the destination expects
- Filtering conditions are more expressive
- A central place to see and govern event traffic
Things to consider
- More moving parts to design and name well
- Features and availability may differ from the standard edition
- Pricing and limits differ, so check the current documentation
- Teams need clear rules about who owns buses and pipelines
Choose the standard edition for a few straightforward trigger-to-destination links. Consider the advanced edition when many teams share events, when you publish custom events, or when one event must reach several destinations.
10Architecture and Main Components
Behind the simple console is a layered design that receives, filters, stores briefly and delivers events.
The big picture
Events are generated by sources and enter the Eventarc system. They are checked against triggers or enrollments to see who is interested. Matching events are handed to a delivery layer, which authenticates to the destination, sends the event and waits for a response. If the destination does not confirm, the delivery layer holds the event and tries again according to its retry rules. The whole path is managed by Google, so scaling, patching and availability are not your concern.
flowchart LR
A["Event sources"] --> B["Eventarc event intake"]
B --> C["Filter matching: triggers or enrollments"]
C --> D["Transport and retry layer"]
D --> E["Authenticated delivery"]
E --> F["Destination handles event"]
F --> G["Success response confirms delivery"]
F --> H["Error response causes retry"]
H --> D
Intake
Receives events from providers and attaches the standard attributes.
Matching
Compares each event with the conditions of triggers or enrollments to decide where it should go.
Transport
Holds events safely while delivery is attempted and retried. In the standard edition this uses Pub/Sub.
Delivery
Calls the destination with proper credentials and records the result.
A courier company has an intake desk, a sorting room, a holding shelf for parcels that could not be delivered the first time, and drivers who knock on doors. If nobody answers, the parcel returns to the shelf and the driver tries again later. Eventarc’s layers play the same roles.
11Internal Working: How One Event Travels
Follow a single event from the moment it happens to the moment it is handled.
Something happens
A user uploads a photo to a storage bucket. The storage service records the change and produces an event describing it.
The event enters Eventarc
The event is received with its attributes, such as type, source, subject and time, and a payload with details of the file.
Matching rules are checked
Eventarc compares the event with every trigger or enrollment in the right location. Only those whose conditions match will receive it.
The event is queued for delivery
The event is placed in the transport layer so that it is not lost if the destination is busy or briefly unavailable.
Delivery with credentials
Eventarc calls the destination with a signed identity token for the trigger’s service account, so the destination can verify the caller.
The destination handles it
The image service reads the file, creates a thumbnail and stores it. It returns a success response.
Confirmation or retry
On success, the event is marked as delivered. On an error or timeout, it is retried with increasing delay for a limited time.
A customer drops a package at a collection point. The point staff note what it is and where it came from, check which delivery route is responsible, put it in the van, and the driver shows an official badge at the door. If the recipient is out, the driver tries again later.
Understanding these seven steps makes troubleshooting much faster. When an event seems lost, ask at which step it stopped: was it produced, did it match, was it delivered, did the destination accept it?
12Delivery Guarantees: At Least Once, and What That Means
The most important behavior to understand in any event system is what it promises about delivery.
At-least-once delivery
Eventarc aims to deliver each event at least once. This is the usual promise of distributed messaging systems. It means that the event will not be silently dropped while the system is working normally, but it also means that in some situations the same event may be delivered more than once. For example, if the destination processed an event but the confirmation was lost on the way, Eventarc will try again, and the destination will see the event a second time.
No silent loss
Events are retried until they are confirmed or until the retry period ends.
Possible duplicates
Retries after lost confirmations, timeouts or restarts can cause repeated delivery.
No guaranteed order
Events may arrive in a different order from the one in which they were produced, especially under retries.
Retention is limited
Retries continue only for a limited period, so a destination that is down for a very long time may miss events.
A courier promises that your parcel will be delivered, and if you were not home it will come back tomorrow. Occasionally two couriers might both deliver the same parcel because a note got lost. You will not lose the parcel, but you may have to handle two copies, so you need a way to recognize the repeat.
Writing a handler that charges a customer, sends an email or adds to a total every time it receives an event, without checking whether it has already handled that event. A duplicate then causes a double charge or a double email.
13Idempotency: Making Repeats Harmless
An idempotent handler gives the same result whether it runs once or many times for the same event.
Simple techniques
Remember processed event ids
Keep a record of the ids of events you have already handled, in a database or fast store. When an event arrives, check the record first. If the id is already there, skip the work and return success.
Use natural unique keys
If the event is about creating a record for a specific file or order, use the file name or order number as the record key. Writing the same key twice then overwrites, instead of adding a duplicate.
Make operations set, not add
“Set the status to complete” is safe to repeat. “Add one to the counter” is not. Where possible, design operations so that repeating them changes nothing.
Use conditional updates
Update a record only if it is still in the expected previous state. A repeated or late event then finds that the state has already moved on and does nothing.
Pass idempotency keys downstream
When your handler calls another service, such as a payment service, send the event id as an idempotency key so that the other service can also ignore repeats.
A light switch labeled “on” is idempotent: pressing “on” five times leaves the light on. A button that toggles is not, since five presses give a different result than one. Design handlers like the “on” switch.
Handling order problems
Because events can arrive out of order, an old event might arrive after a newer one. Use the event time or a version number in the data, and ignore events that are older than what you already have. For example, if the record already shows version seven, an event for version six should be ignored.
Test idempotency on purpose. In a test environment, send the same event twice, and send two related events in reverse order. If the final state is wrong, fix the handler before going to production.
14Filtering: Receiving Only the Events You Need
Good filters keep consumers focused, reduce cost and avoid accidental loops.
What you can filter on
Filters work on attributes of the event. The most common is the event type, such as an object being finalized in storage. You can also filter on the source or the resource, such as one specific bucket, or on attributes specific to the provider, such as the name of a method in an audit log entry. In some cases you can use patterns, which match many similar values at once, such as all files under a certain folder path. The advanced edition offers a more expressive condition language that can combine several tests.
By event type
Accept only one kind of event, such as new files and not deletions.
By resource
Accept events from one bucket, topic or service, and ignore the rest.
By path pattern
Accept files only in a certain folder or with a certain name pattern.
By audit method
For audit log events, accept only a specific action, such as creating a particular resource.
A fire station does not want calls about lost cats. The dispatcher filters calls so that only fire reports reach the fire station. Good filtering keeps every team focused on the work that is really theirs.
Avoiding event loops
A classic mistake is a loop. Suppose a function resizes every new image in a bucket and writes the resized image back into the same bucket. That write creates a new event, which triggers the function again, which writes another image, and so on, forever, with a growing bill. Avoid this by writing results to a different bucket or folder, and by filtering so that the function ignores its own outputs.
Triggering on all events in a bucket and writing output to the same bucket. Use separate locations for inputs and outputs, and add filters so that your own output never retriggers the handler.
15Transforming and Enriching Events
Sometimes the event as produced is not the shape that the destination wants. The advanced edition can reshape it on the way.
Why transform at all
Different systems expect different layouts. A destination written years ago may want a flat message with only three fields, while the event carries dozens of nested details. Without transformation, you would have to write extra code in every consumer to dig out what it needs. With a transformation step inside the pipeline, the event is reshaped before it is delivered, so the destination receives exactly what it understands. This keeps consumers simple and keeps the knowledge about event shapes in one central place.
Pick fields
Keep only the details the destination needs and drop the rest, which reduces size and avoids leaking unnecessary data.
Rename and reorganize
Change names and structure to match the format that the destination expects.
Convert formats
Adjust how the payload is encoded, for example between common data formats, where supported.
Add context
Attach fixed values such as an environment name or a team label, so consumers can tell where an event came from.
A translator at an international meeting turns each speech into the language of the listener. The speaker does not change how they talk, and the listener does not learn another language. A transformation step is the translator between event producers and consumers.
Keep transformations small and focused on reshaping. Put real business logic in your consumer code, where it can be tested, versioned and debugged with normal tools. Details of what the pipeline can do change over time, so confirm in the current documentation.
Hiding complex decisions inside transformation expressions that nobody on the team understands. When something goes wrong, nobody can explain why an event looked the way it did. Document every transformation and keep it simple.
16Locations, Regions and Data Residency
Where a trigger or bus lives matters for correctness, speed and compliance.
Matching the source
Many event sources are tied to a location. A storage bucket in one region produces events in that region. For such sources, the trigger usually has to live in a matching location, otherwise no events will reach it. Some sources are global, and for those a global trigger can be used. When in doubt, the documentation for each provider states exactly which location rules apply, and the console will often warn you if the location does not fit.
Regional triggers
Used when the source resource has a single region. Events stay inside that region from the source to the destination, which supports data residency rules.
Multi-region sources
Some storage buckets span a multi-region, such as a large geographic area. Their triggers use a matching multi-region location. Check the documentation for how the matching works.
Global triggers
Used for global sources. Delivery goes to a destination in a chosen region, but the event itself may travel through global infrastructure, which matters if strict residency is required.
A local fire station only answers calls from its own district. If you register your standing instructions with the wrong district office, the calls will never reach you. The location of your trigger must match the district where the event happens.
Destination in a different region
A trigger in one region can often deliver to a destination in another region, but this adds delay and cross-region network traffic, and it can conflict with residency rules. When possible, keep the source, the trigger and the destination in the same region.
Choosing locations by habit rather than by data rules. A team may create everything in a default region while customer data must stay in another country. Decide locations at the start and enforce them with organization policy.
17Security: Identities, Permissions and Trust
An event system touches many services, so careful identity and permission design keeps it safe.
The identity used by a trigger
Every trigger or pipeline works with a service account. This account must be allowed to receive events through Eventarc, and it must be allowed to call the destination. For example, to deliver to a Cloud Run service, the account needs permission to invoke that service. If the destination is a workflow, it needs permission to run workflows. Eventarc then calls the destination with a signed identity token for this account, and the destination can verify that the call is genuine.
Create a dedicated service account
Use a separate account for each trigger or related group, named after the purpose.
Grant the receiver role
Give it the role that lets it receive events through Eventarc.
Grant invoke permission on the destination
Allow it to call only the specific destination, not every service in the project.
Allow Google’s service agents where required
Some providers need extra roles for Google-managed service agents, such as permission to publish or to create tokens. The setup guide lists them.
Require authentication on the destination
Configure the destination to reject unauthenticated calls, so that only Eventarc’s identity can deliver events.
A courier arriving at a secure building must show an official badge, and the guard checks that this badge is allowed to enter this particular office. The service account is the badge, and the invoke permission is the guard’s list of who may enter which office.
Other security habits
Least privilege
Grant only the roles that the trigger really needs, and never a broad owner or editor role.
Private destinations
Where possible, deliver to services that are not open to the internet and require authentication.
Protect sensitive data in events
Events may contain names of files or details of records. Keep personal data out of event payloads where you can, and send identifiers instead.
Audit changes
Use audit logs to see who created or changed triggers, buses and pipelines, and alert on unexpected changes.
Allowing unauthenticated access to the destination “to make it work”. Anyone who discovers the address can then send fake events. Always require authentication and grant the invoker role only to the trigger’s service account.
18Private Delivery and Networking
Not every destination lives on the public internet. Eventarc can reach services inside your private network.
Delivering inside a virtual network
Many companies run internal services that have no public address. Eventarc can deliver events to such internal web addresses by connecting to your virtual private cloud network through a managed private connection. The traffic stays on Google’s private network and never crosses the public internet. This is important for regulated industries and for services that must not be reachable from outside.
Private services in your own network
An internal application running on virtual machines or in a cluster can receive events at a private address, with firewall rules controlling exactly who may reach it.
Hybrid targets
With a private link to your own data center, internal addresses there may also be reachable, letting events trigger on-premises systems. This needs careful network planning.
Service perimeters
Organizations that use perimeters to prevent data from leaving a protected zone should check which Eventarc features are supported inside a perimeter, since support may vary by edition and provider.
A hospital has public entrances for visitors and a private corridor connecting wards. Urgent notices between wards go through the private corridor, never through the lobby. Private delivery is that internal corridor.
Design network access at the same time as the trigger. Decide which subnet and firewall rules will allow delivery, and test with a harmless event before relying on the path for production work.
19Audit Log Events in Depth
Audit log events let you react to almost any action in Google Cloud, which makes them a favorite tool for security and governance automation.
How they work
Whenever someone or something calls a Google Cloud API, the call can be recorded in an audit log. Eventarc watches for log entries that match your filter and turns them into events. The filter names the service and the method, such as the creation of a firewall rule or a change to an access policy. When a matching entry appears, the event is delivered to your destination, which can then check the change, notify people or fix the problem automatically.
Admin Activity logs
Record changes to configuration, such as creating or modifying resources. They are on by default and cannot be turned off.
Data Access logs
Record reads and writes of data. For most services they are off by default and must be switched on, which adds cost and volume.
Security automation
React when a risky setting appears, such as a firewall rule open to the whole internet, and alert or remove it.
Governance and tagging
Automatically add labels or notify owners when new resources are created, so nothing exists without an owner.
A building keeps a logbook of every door that is opened. A security guard who reads the logbook in real time can react when the server room door opens at midnight. Audit log events are that logbook, read automatically.
Things to be careful about
Strengths
- Wide coverage of services and actions
- Good for administrative and security events
- No change needed in the source service
Cautions
- Slight delay compared with direct events
- Data access events need extra logging and cost
- Filters must match the exact service and method names
- Automatic fixes can loop if they cause new matching log entries
Building a remediation function that changes a resource, which creates a new audit entry, which triggers the function again. Always filter out the function’s own identity and make the fix idempotent so that a second look finds nothing left to change.
20Storage and Other Direct Event Flows
The most common first project with Eventarc is reacting to files, so it is worth looking at the flow in detail.
A typical file-processing flow
A file lands in an input bucket
A user, a partner system or another application uploads a file.
Storage emits an event
When the upload completes, an event of the type “object finalized” is produced, naming the bucket and the file.
Eventarc delivers it to your service
A trigger with a filter for that bucket and event type sends the event to a Cloud Run service.
The service processes the file
It reads the file by name, performs the work, such as resizing, scanning or converting, and writes the result to a different output bucket.
It records the outcome
The service updates a database or sends a notice so that the rest of the system knows the file is ready.
Useful event types for files
Object finalized
A new object has been fully created or an existing one overwritten. This is the usual trigger for processing.
Object deleted
An object has been removed. Useful for cleaning up related records or derived files.
Object archived and metadata updated
Signals changes in storage class or labels, which can drive lifecycle and governance actions.
A mailroom clerk receives a parcel and rings a bell. A packing team hears the bell, opens the parcel, repacks the contents and puts the result on a different shelf so that the bell does not ring again for the same parcel.
Remember that the event contains the name of the file, not its content. Your handler fetches the file itself. Large files can take time to process, so make sure your destination timeouts and memory settings are suitable.
21Custom Events and Publishing to a Bus
Your own applications can also announce events, turning Eventarc into the backbone of your system.
Why publish your own events
Google Cloud services announce what they do, but only your application knows when an order is placed, a payment is approved or a customer signs up. By publishing these facts as events, you let other parts of the system react without being called directly. The order service simply announces “order placed” and moves on. The inventory service, the email service and the analytics service each listen and do their own work. Later you can add a fraud service without changing the order service at all.
Define the event contract
Agree on the event type name, the required fields and the meaning of each, so that all teams understand it the same way.
Publish to a bus
The producing service sends events in the standard envelope to the message bus through the supported interfaces.
Create enrollments for consumers
Each interested team creates an enrollment with a condition for the events it wants and a pipeline to its destination.
Evolve carefully
Add fields rather than changing or removing them, and version event types when a breaking change is unavoidable.
A town crier announces news in the square, and each shopkeeper decides whether the news matters to them. The crier does not walk to each shop. The more shops that care, the more the system benefits, with no extra work for the crier.
Design events as facts
Past-tense names
Name events for something that has already happened, such as “order placed” or “invoice paid”, not for a command such as “place order”. Events state facts, and consumers decide what to do.
Enough detail, but not everything
Include the identifiers and key facts that most consumers need. Avoid dumping whole records, which couples consumers to your internal structure and may leak private data.
Stable, documented schemas
Document each event type like a public interface. Once other teams depend on it, changes need coordination.
Treating events as hidden commands, so that the producer secretly depends on a particular consumer doing something. If the producer needs a response or a guarantee, use a direct call or an orchestrated workflow instead of an event.
22Orchestrating Multi-Step Work With Workflows
One event often starts a process with several steps. Workflows is the natural partner for that job.
Why not do everything in one function
Suppose a new file must be checked for viruses, converted, indexed, copied to an archive and announced to the owner. A single function doing all of that becomes long, fragile and hard to retry safely, because a failure in step four forces a repeat of steps one to three. A workflow instead describes the steps, calls each service in turn, waits where needed, retries only the failed step, and records the progress. Eventarc simply starts the workflow when the event arrives.
flowchart TD
A["File uploaded"] --> B["Eventarc trigger starts workflow"]
B --> C["Step 1: scan the file"]
C --> D{"File clean?"}
D -- "No" --> E["Quarantine and notify security"]
D -- "Yes" --> F["Step 2: convert the file"]
F --> G["Step 3: update search index"]
G --> H["Step 4: archive original"]
H --> I["Step 5: notify the owner"]
When a hospital patient arrives, the reception bell rings, and a coordinator opens the patient’s checklist: registration, triage, tests, treatment, discharge. If the test equipment is busy, only that step waits. The bell is Eventarc, and the coordinator with the checklist is Workflows.
Use a direct destination when
- The reaction is a single, short action
- Failure of the action is easy to retry
- No branching or waiting is needed
Use a workflow when
- There are several ordered steps
- Decisions or branches depend on results
- You need clear progress records and partial retries
- Some steps are slow or must wait for approval
Pass the event data as the input of the workflow and let each step use only what it needs. Give the workflow its own service account with exactly the permissions of the services it calls.
23Error Handling, Retries and Failed Events
Things fail. A good event design decides in advance what happens when they do.
Retries, in simple terms
When a destination responds with an error or does not respond in time, Eventarc retries delivery. The retries use increasing waits between attempts, so a struggling service is not overwhelmed. Retrying continues for a limited period, after which the event is dropped. The exact retry behavior depends on the edition, the destination and settings, so read the current documentation for the details that apply to your setup.
flowchart TD
A["Event delivered to destination"] --> B{"Success response?"}
B -- "Yes" --> C["Event marked as delivered"]
B -- "No" --> D["Wait with increasing delay"]
D --> E{"Still within retry period?"}
E -- "Yes" --> A
E -- "No" --> F["Event expires and may be lost"]
Separating temporary from permanent failures
Temporary failures
A database is briefly busy or a downstream service is restarting. Returning an error so that Eventarc retries is the right response, because waiting will probably fix it.
Permanent failures
The event is malformed, refers to a record that does not exist, or violates a rule. Retrying will never fix it, and repeated retries waste money and hide real problems. Record the problem, alert a human, and return a success response so that the event is not retried forever.
Keeping a record of what failed
Because built-in options for storing failed events can be limited, many teams add their own safety net. The handler writes problem events, with their id and the reason, to a separate store such as a dedicated topic, a table or a bucket, and an operator or a repair job looks at them later. Check the current documentation for any built-in dead-letter features available in your edition, and design your own handling where they are missing.
When a courier cannot deliver a parcel because the house is empty, they try again tomorrow. But if the address does not exist at all, they stop trying and put the parcel in a “problem parcels” room for the manager to investigate.
Returning an error for every problem, including permanent ones. The event is retried again and again until the retry period ends, then silently disappears. Treat permanent failures as handled by recording them, and reserve errors for temporary ones.
24Observability: Seeing What Your Events Are Doing
Event-driven systems are invisible by default. Logs, metrics and traces make them visible.
Three questions to answer at all times
Are events flowing?
Track how many events are produced, matched and delivered per period. A sudden drop to zero is often the first sign of a broken source or trigger.
Are they arriving quickly?
Measure the delay between the event time and the time your handler receives it. Growing delay shows backlog or slowness.
Are they being handled correctly?
Track the success and error rate of your destination, the number of retries and the number of events recorded as permanent failures.
Tools to use
Cloud Logging
Your handler’s logs show what each event did. Include the event id and type in every log line so that you can follow one event from start to finish.
Cloud Monitoring
Create dashboards and alerts for destination errors, latency and instance counts, and use any available Eventarc and transport metrics to watch delivery and backlog.
Cloud Trace and correlation
Pass a correlation identifier through every step so that a chain of events across services can be reconstructed during an investigation.
A parcel tracking page shows when the parcel was collected, sorted, loaded and delivered. Without it, you only know whether the parcel arrived or not. Observability for events is that tracking page for every notification in your system.
Set an alert for “no events received for a long time” on sources that normally produce steady traffic. Silence is often the sign of a broken trigger, and no error message will tell you.
25Performance, Scaling and Latency
Eventarc scales by itself, but your destinations must be able to keep up.
What decides speed
The source
Direct events from services are usually quick. Audit log events pass through the logging system and may arrive a little later.
The destination
A slow handler is the most common cause of delay. If a handler takes thirty seconds per event, a burst of thousands of events will create a backlog unless the destination can scale out.
Cold starts
A serverless destination that has scaled to zero needs a short time to start when the first event arrives. For latency-sensitive work, keeping a minimum number of instances ready can help.
Downstream limits
A burst of events can overwhelm a database or an external service that your handler calls. Controlling the number of concurrent handlers protects those dependencies.
Handling bursts
Let the destination scale out
Configure sensible maximum instance counts and concurrency so that bursts are absorbed, but do not allow unlimited growth that could swamp downstream systems.
Do quick work and hand off the slow part
Accept the event, record it and put long-running work onto a task queue, then return success quickly.
Protect dependencies
Use limits and back-off when calling databases or external services so a flood of events does not cause a second failure.
Test with realistic bursts
Send a large batch of test events and watch latency, errors and costs before a real surge arrives.
A restaurant can seat more guests when more waiters arrive, but the kitchen has a fixed number of stoves. If the waiters take orders faster than the kitchen can cook, the problem only moves. Event handlers need to scale, and so do the systems behind them.
26Cost: What You Pay For
Event-driven systems can be very economical, but the costs come from several places.
Pricing depends on the edition and on the type of event, and it can change over time, so always confirm the current figures on the official pricing page. In general, remember that an event system costs money in more than one place.
Eventarc itself
Some event types and editions are charged by volume of events, and others may include a free allowance. Check which applies to your sources.
Transport
In the standard edition, the Pub/Sub transport can create its own charges according to data volume.
Audit logging
Audit log events depend on logs. Data Access logs in particular can be large, and logging charges apply to their volume.
Destinations
Cloud Run, functions and workflows charge for compute time and steps. Often this is the largest part of the bill.
Network and storage
Data moved between regions and stored in buckets or databases adds to the total.
Mistakes
Loops, retry storms and over-broad filters can multiply events and cost very quickly.
Ways to keep costs low
Filter precisely
Receive only the events that you need. Every unnecessary event costs transport and compute.
Prevent loops and retry storms
Separate input and output locations, handle permanent failures without retrying and set limits on instances.
Enable data logs selectively
Turn on Data Access audit logs only for the services and projects where you really need them.
Set budgets and alerts
Create billing alerts so that a runaway event flow is noticed in hours, not at the end of the month.
Judging the cost of an event system only by the Eventarc line on the bill. The real cost is the whole chain: events, transport, logs, compute and storage. Look at the full chain when you estimate and when you review.
27Quotas, Limits and Planning for Growth
Every managed service has limits. Knowing them early prevents unpleasant surprises in production.
Eventarc and its neighbors have limits on things such as the number of triggers or buses per project and location, the size of an event, the rate of events and how long failed deliveries are retried. Exact numbers change over time and differ by edition, so this guide does not list them. Always read the current quotas page, and plan around the kinds of limits that exist.
Object counts
Maximum numbers of triggers, buses, enrollments and pipelines. Large organizations should plan naming and ownership so these are not exhausted.
Event size
Events carry limited payloads. Send identifiers and fetch large data from storage rather than placing it inside events.
Throughput
Rates of events per second per location. Very high-volume sources may need a messaging service designed for streaming.
Retry period
The time during which failed deliveries are retried. A destination down for longer may lose events, so have a recovery plan.
Destination limits
Timeouts, concurrency and memory of Cloud Run or functions, which shape how long a single event may take to handle.
Provider-specific limits
Some event sources have their own rules about which events are produced and how quickly.
A road has a speed limit, a weight limit for trucks and a number of lanes. A driver who knows them in advance plans the route and the vehicle. A team that knows the service limits designs events that fit within them.
Add a simple checklist item to your design reviews: “Which limits could this design reach in a year?” It is much easier to choose a different approach early than to redesign a running system under pressure.
28Design Patterns That Work
Teams that build reliable event-driven systems tend to repeat a few simple designs.
Fan-out
One event reaches several independent consumers, each doing its own job. With the advanced edition, this is done through several enrollments on the same bus. Each consumer can fail or be changed without affecting the others.
Filter at the edge
Apply precise filters in the trigger or enrollment, so consumers receive only relevant events and contain no unwanted-event logic.
Idempotent consumer
Every handler is safe to run twice. It records processed event ids or uses natural keys so that repeats change nothing.
Claim check
Instead of placing large data in the event, store the data in a bucket and send only its location. Consumers fetch it when they need it.
Event-started workflow
Use Eventarc only to start a workflow, and let the workflow handle ordering, branching and retries for multi-step processes.
Separate input and output
Write results to a different bucket, topic or folder than the one that triggers the work, which prevents loops by design.
Quick accept, slow work later
The handler validates the event, stores a task and returns success quickly. A queue and a worker complete the long work at a controlled pace.
Correlation identifiers
Carry one identifier through every event and log line in a chain so that the full story of one business action can be reconstructed.
A well-run newsroom sends each story to several desks, filters by topic, keeps a record of what has been published, stores big photographs in an archive and passes only the archive number around. These patterns are the same good habits for events.
29Anti-Patterns to Avoid
These mistakes appear again and again in event-driven systems that become expensive, fragile or confusing.
Problem
A handler writes its result into the same bucket that triggers it, with no filter to ignore its own output.
Why It’s Harmful
Every output creates a new event, which triggers the handler again, which creates another output. The loop runs until somebody notices the bill, and it can fill storage with junk.
Correct Approach
Write outputs to a separate bucket or folder, filter on input locations only and set instance and budget limits as a safety net.
Problem
The handler assumes each event arrives exactly once, in order, and performs actions such as charging, emailing or incrementing counters each time.
Why It’s Harmful
Retries and lost confirmations cause duplicates, which lead to double charges, repeated emails and wrong totals. Out-of-order events can overwrite newer data with older data.
Correct Approach
Make handlers idempotent, record processed event ids, use natural keys and ignore events older than the stored state.
Problem
Destinations are left open to unauthenticated calls so that triggers work without permission setup.
Why It’s Harmful
Anyone who finds the address can send fake events and make your service perform actions. Security reviews will flag it, and attackers may exploit it.
Correct Approach
Require authentication on destinations and grant the invoker permission only to the trigger’s dedicated service account.
Problem
Every error, including malformed events and missing records, is returned as a failure so that Eventarc retries.
Why It’s Harmful
Permanent problems never fix themselves, so the event is retried pointlessly until it expires and vanishes. The retries waste money and hide the real cause.
Correct Approach
Retry only temporary failures. Record permanent failures in a separate store, alert a human and return success so the event is closed.
Problem
Events are used as hidden commands, and the producer silently relies on one specific consumer to do something.
Why It’s Harmful
If that consumer is slow, broken or removed, the producer’s business process fails with no visible link. The system becomes tangled while pretending to be loosely coupled.
Correct Approach
Use events for facts that anyone may react to. When a response or guarantee is required, use a direct call or an orchestrated workflow.
Problem
No one monitors event flow. The team learns that a trigger has stopped working only when users complain.
Why It’s Harmful
Event systems fail quietly. A broken trigger produces no errors, only silence, and days of missed events may pass before anyone notices.
Correct Approach
Create dashboards and alerts for event volume, delivery delay and handler errors, including an alert for unusual silence.
30Best Practices and Common Mistakes
A short, practical checklist for anyone building with Eventarc.
Best practices
- Choose the right edition. Use standard triggers for simple one-to-one links and consider the advanced edition for shared buses, custom events and fan-out.
- Filter precisely. Accept only the events you need, in the right location and type.
- Assume duplicates and disorder. Write idempotent handlers and tolerate events arriving late or out of order.
- Authenticate everything. Use dedicated service accounts, least privilege and destinations that reject unauthenticated calls.
- Separate inputs from outputs. Never let a handler’s output trigger itself.
- Handle failures deliberately. Retry temporary errors, record permanent ones and alert humans.
- Keep events small. Send identifiers and locations, not large payloads or personal data.
- Document event contracts. Treat event types and fields like public interfaces and evolve them carefully.
- Observe the flow. Log event ids, track volume and delay, and alert on silence.
- Use workflows for multi-step work. Let Eventarc start the process and the workflow coordinate it.
- Manage configuration as code. Keep triggers, buses, enrollments, pipelines and permissions in version control.
- Set budgets and limits. Cap instances and create billing alerts to stop runaway flows early.
Do this
- Use event id for duplicate detection
- Keep locations aligned with sources
- Write results to separate locations
- Test with duplicate and reversed events
- Alert on silence and on delay
Avoid this
- Triggering on everything and filtering in code
- Using open, unauthenticated destinations
- Putting big payloads inside events
- Returning errors for permanent problems
- Changing event fields without telling consumers
Building an event-driven system without a map of who produces and who consumes each event. After a year nobody knows which services depend on which events, and every change feels dangerous. Keep a living catalog of event types, owners and consumers.
31Troubleshooting Common Problems
Most problems fall into a few families. A calm, ordered check finds them quickly.
No events arrive at all
Check that the trigger exists in the right location, that its filters match the real event type and resource, that the source is actually producing events and that required logs or APIs are enabled.
Events arrive but the destination rejects them
Check the invoke permission of the service account, that the destination path is correct and that the destination accepts authenticated web requests.
Duplicates in the destination
This is expected behavior in some cases. Add idempotency using the event id and check that the handler returns success only after the work is safely done.
Events are slow to arrive
Check handler latency, instance limits, cold starts and, for audit events, the delay of the logging path. Look for a backlog that grows.
Endless retries
Look for handlers that return errors for permanent problems, timeouts shorter than the work needs and crashes caused by malformed data.
Unexpected explosion of events
Look for loops where outputs retrigger inputs, over-broad filters and automation reacting to its own changes. Pause the trigger first, then fix.
Audit log events missing
Check that the needed log type is enabled, that the service and method names in the filter are exact and that the log entry really exists in the logs viewer.
Permission errors during setup
Check roles for the service account, for Google’s service agents and for the person creating the trigger, and read the error message for the exact missing permission.
When a doorbell does not ring, you check in order: is the visitor pressing the button, is the wire connected, is the chime switched on, is anyone at home to hear it? Checking each link in the chain in turn finds the fault faster than guessing.
An ordered investigation
Was the event produced?
Confirm in the source service or the audit logs that the action really happened.
Did the filter match?
Compare the real event attributes with the filter. Small differences in type, resource or location are the usual cause.
Was it delivered?
Check the destination’s request logs for an incoming call at the right time.
Was it accepted?
Look at the response code and any authentication error in the logs.
Was it handled correctly?
Follow the event id through your own logs and the results in your database or storage.
32Real-World and Industry Examples
The same service solves very different problems depending on the kind of organization.
A photo-sharing app
When a user uploads a picture, an event starts a service that creates thumbnails, checks the image for unsafe content and stores the results in another bucket. As the app grows, the team adds a new consumer for face blurring without touching the upload path.
A bank’s security team
Audit log events trigger a function whenever someone grants a powerful role or opens a firewall to the internet. The function alerts the security channel, opens a ticket and, for the most dangerous cases, reverses the change automatically after logging it.
A retailer processing orders
The order service publishes an “order placed” event to a bus. Separate enrollments send it to inventory, shipping, email and analytics. A fraud check is added later as one more enrollment, with no change to the order service.
A data platform team
When a partner delivers a data file to a bucket, an event starts a workflow that validates, loads and publishes the data, then notifies consumers. Failures are recorded and shown on a dashboard, not discovered through angry emails.
A platform team enforcing standards
Each time a new virtual machine or database is created, an event triggers a function that checks required labels and notifies the owner if they are missing. After two weeks the team enables automatic labeling by default.
A software company integrating with partners
Events from an outside provider arrive through a partner source. The team routes them into internal services and uses transformations to match the formats that older internal systems expect.
A small start-up
One trigger and one Cloud Run service process uploaded invoices. The whole setup takes an afternoon, costs very little, and removes the need for a polling job that used to run every minute.
33Advantages, Disadvantages and Choosing the Right Tool
No design is perfect. Knowing the trade-offs helps you pick the right approach for each need.
Advantages
- Fully managed, with no brokers or servers to run
- Standard CloudEvents format across many sources
- Wide choice of sources, including audit logs and your own events
- Flexible destinations from serverless to private endpoints
- Filtering and, in the advanced edition, transformation and fan-out
- Integrates with IAM, logging, monitoring and workflows
Disadvantages / Trade-offs
- At-least-once delivery means duplicates and disorder must be handled
- Event-driven flows are harder to trace than direct calls
- Location, permission and filter rules can be fiddly at first
- Built-in handling of permanently failed events can be limited
- Audit log events add delay, logging cost and complexity
- Editions differ, so features and limits need careful reading
Standard and Advanced at a glance
| Question | Eventarc Standard | Eventarc Advanced |
|---|---|---|
| Main building block | Trigger with filters and one destination | Bus, enrollments and pipelines |
| Sources | Google Cloud direct and audit log events, Pub/Sub, partners | Google Cloud sources and custom events published to a bus |
| Fan-out to many destinations | Create several triggers | Create several enrollments on one bus |
| Reshaping events | Done in your consumer code | Can be done in the pipeline |
| Good first choice when | You need a quick, simple link from one source to one service | You need a shared event backbone for several teams |
Eventarc compared with neighbors
| Need | Best tool | Reason |
|---|---|---|
| React to cloud events with filtering and standard format | Eventarc | Built for event routing |
| High-volume streaming and message queues | Pub/Sub | Designed for throughput and consumers pulling data |
| Time-based jobs | Cloud Scheduler | Triggered by the clock |
| Controlled queue of tasks created by code | Cloud Tasks | Rate control and per-task retry |
| Ordered multi-step processes | Workflows | Clear state, branching and error handling |
34Configuration as Code and Automation
Triggers and buses should be written down, reviewed and applied by a pipeline, not clicked together by hand.
Why it matters more for events
An event-driven system is made of many small rules spread across projects: triggers, filters, permissions, destinations. If these are created by hand, nobody can see the whole picture, and changes happen without review. A missing trigger produces silence instead of an error. Writing the configuration as code makes the picture visible, reviewable and repeatable.
Terraform and similar tools
Describe triggers, buses, enrollments, pipelines, service accounts and role grants in configuration files stored in version control.
Command line and interfaces
The gcloud tool and the Eventarc interfaces let scripts create and update resources for repeatable setups.
Continuous delivery pipelines
Pipelines apply reviewed changes to test and then to production, giving every environment the same wiring.
Policy checks
Automatic checks reject changes that use broad roles, open destinations or forbidden locations before they are applied.
An electrician who draws a wiring diagram and files it can be replaced, audited and trusted. An electrician who wires a building from memory leaves the next person guessing which wire does what. Configuration as code is the filed wiring diagram.
Describe the wiring
Write the trigger or pipeline, its filters, its destination and its service account in a file.
Review
A teammate checks the filter, location and permissions against the design and the security rules.
Apply through the pipeline
The change is deployed to a test environment, then to production, with the same files.
Detect drift
Regularly compare reality with the files, and bring any manual changes back under control.
35Testing Event-Driven Systems
Event systems fail in ways that ordinary tests miss, so they need their own kinds of tests.
Handler tests
Run the handler with sample events, including events that are malformed, incomplete or missing optional fields. Verify that it returns the right response for each case.
Duplicate tests
Send the same event twice and verify that the final state is identical to receiving it once.
Order tests
Send related events in reverse order and confirm that older events do not overwrite newer data.
Integration tests
In a test project, trigger the real event, such as uploading a test file, and verify that the entire chain works from source to result, including permissions and filters.
Failure tests
Make the destination fail on purpose and watch the retries, the recorded failures and the alerts. Confirm that the team would really notice.
Load tests
Send a burst of events to see how the destination scales, how long the backlog lasts and what the bill would be.
A fire alarm system is tested by pulling the alarm during a drill, not by reading the wiring diagram. Event systems need drills too: real events, repeated events, wrong-order events and failing responders.
Keep a small library of sample events for each event type your system handles, including unusual ones. New team members and automated tests can use the same samples, which makes behavior consistent.
36Evolving Event Contracts Safely
Once other teams depend on an event, changing it carelessly breaks them. Treat event types like public interfaces.
Safe changes
Adding optional fields
Consumers that do not know about a new field simply ignore it. This is the safest way to grow an event over time.
Adding new event types
New facts get new type names. Existing consumers are not affected, because their filters do not match the new type.
Risky changes
Removing or renaming fields
Consumers that read the field will break or behave incorrectly. Announce the change, support the old and new forms together for a while, and remove the old one only when nobody uses it.
Changing meaning
Keeping a field name while changing its meaning, such as switching an amount from cents to dollars, is the most dangerous change because nothing visibly breaks while results become wrong.
Versioning
When a breaking change cannot be avoided, create a new version of the event type with a clear version in its name or schema reference, publish both versions during a migration period and track which consumers still use the old one. Keep a catalog that lists every event type, its owner, its documentation and its known consumers.
A publisher who changes the size of a magazine without warning breaks every shelf that was built for it. A sensible publisher announces a new edition, prints both sizes for a while and removes the old one only when the shelves have been replaced.
37A Practical Adoption Roadmap
You do not need a perfect design on day one. Build in stages, learning as you go.
Week one: one simple trigger
Choose a safe use case, such as processing uploaded files, and wire one trigger to one Cloud Run service with a dedicated service account. Learn the permissions, locations and logs.
Weeks two to three: reliability basics
Add idempotency, error handling for permanent failures, event id logging, dashboards and an alert for silence and for errors.
Month two: configuration as code and guardrails
Move triggers and permissions into version control, add policy checks, set budgets and agree naming and ownership rules.
Month three: orchestration and audit automation
Introduce workflows for multi-step processes and audit log events for security and governance reactions, with careful loop protection.
Month four: custom events and shared bus
Define event contracts, publish your own events and move to a shared bus with enrollments where several teams need the same events.
Ongoing: catalog, review and improve
Maintain the event catalog, review failures and costs regularly, test failure and burst scenarios and retire unused triggers.
How to know it is working
Good signs include fewer polling jobs, quick reactions to changes, handlers that survive duplicates, dashboards that show event flow, alerts that catch silent failures early, new consumers added without touching producers, and a clear catalog that any new engineer can read in an hour.
38An Illustrative Case Study: Invoice Processing
This example is fictional, but it shows how the ideas in this guide fit together in a small real system.
The situation
A small trading company receives about two thousand supplier invoices every day as PDF files, uploaded by suppliers and by an email gateway into a storage bucket. Until now, a script has run every five minutes to look for new files. It is slow, sometimes misses files and occasionally processes the same file twice. The team wants to replace it with an event-driven design.
Design the flow
New files land in an input bucket. A trigger filters for finalized objects in that bucket and sends the event to a Cloud Run service. Results go to a separate output bucket and a database, so the output never retriggers the service.
Secure it
A dedicated service account receives events and invokes the service. The service itself rejects unauthenticated calls and has permission to read the input bucket and write only to the output bucket and database.
Make it safe to repeat
The service uses the file name and its generation number as a unique key in the database. A repeated event finds the key already marked complete and returns success without redoing the work.
Handle failures deliberately
If the database is busy, the service returns an error and the event is retried. If a file is not a valid invoice, the service moves it to a review folder, records the reason, alerts the finance team and returns success.
Add visibility
Every log line includes the event id and file name. A dashboard shows invoices received, processed and sent to review, plus the delay between upload and completion. An alert fires if no invoices arrive during working hours.
Grow the design
Later, the finance team wants a duplicate-invoice check and an approval step. The team starts a workflow from the same event for these steps, and the original service continues unchanged.
The design worked because the team separated input from output, designed for duplicates from the start, treated permanent and temporary failures differently and watched event flow. None of these ideas is difficult, but all of them matter.
39Measuring the Health of an Event-Driven System
What you measure shows you early whether your event flows are healthy.
Event volume
How many events are produced, matched and delivered per period, compared with the usual pattern. Sudden drops and spikes are both important signals.
End-to-end delay
The time from the moment of the event to the completion of handling. Track the typical value and the slow tail.
Handler success and error rates
The share of events handled successfully, split between temporary errors and permanent failures.
Retry count
How many deliveries are repeated. A rising count shows that a destination is struggling.
Duplicate rate
How often your handler recognizes a repeated event. A sudden increase can reveal timeouts or confirmation problems.
Failed-event backlog
The number of recorded permanent failures waiting for a human or repair job. This should shrink, not grow.
Cost per thousand events
The whole-chain cost, including compute, logs and transport, to spot waste or loops early.
Silence detection
The time since the last event on a source that normally produces steady traffic.
A dispatch center tracks the number of calls, the time to send a responder, how many calls needed a second attempt and how many remain unresolved. These numbers tell the manager whether to add staff or change the process.
Watching only the error rate of the handler. A system with a broken trigger has an error rate of zero, because nothing arrives. Always watch volume and silence as well as errors.
40Common Misconceptions About Eventarc
A few wrong beliefs cause many surprises. Clearing them up early saves time.
Myth: Events arrive exactly once
The promise is at least once. Duplicates can happen, so handlers must be safe to repeat.
Myth: Events arrive in order
Ordering is not guaranteed. Use timestamps or version numbers and ignore stale events.
Myth: Eventarc replaces Pub/Sub
They have different jobs. Eventarc routes events to destinations, and the standard edition even uses Pub/Sub as transport. Pub/Sub remains the choice for high-volume messaging.
Myth: The event contains the file
It contains details about the change, such as the name and size, not the content. Your handler must fetch the data itself.
Myth: Failed events are always saved for me
Retries are limited in time, and built-in storage of failed events can be limited. Design your own handling for permanent failures.
Myth: Audit log events are instant
They travel through the logging path and can arrive later than direct events. Data access events also need extra logging switched on.
Myth: Event-driven means no coordination needed
Loose coupling does not remove the need for contracts, owners, catalogs and monitoring. Without them the system turns into a tangle.
Myth: One trigger can feed any number of services
A standard trigger has one destination. Fan-out needs several triggers, or the advanced edition with a bus and several enrollments.
Each of these myths leads to surprises in production. The cure is the same every time: read the delivery promises, design for repeats and disorder, watch the flow and keep the contracts clear.
41Glossary of Eventarc Terms
A quick reference for the words used in this guide, in alphabetical order.
At-least-once delivery
A promise that an event will be delivered one or more times, never silently lost, with possible duplicates.
Audit logs
Records of actions on Google Cloud resources, which can be turned into events.
Bus
In the advanced edition, a central channel that receives events and passes them to enrollments.
Choreography
A style where services react to events on their own, with no central coordinator.
Claim check
A pattern that stores large data elsewhere and sends only a reference in the event.
CloudEvents
An open standard describing the common envelope of an event.
Consumer
A program that reacts to events.
Correlation identifier
A value passed through a chain of events and logs so that the whole chain can be followed.
Destination
The place that receives an event, such as Cloud Run, a function, a workflow or a private endpoint.
Enrollment
A rule in the advanced edition that matches events on a bus and sends them to a pipeline.
Event
A record that something happened, with details about it.
Event provider
A source of events, such as Cloud Storage or Cloud Audit Logs.
Event type
A name that describes the kind of event.
Fan-out
Delivering one event to several independent consumers.
Filter
A condition that decides which events a trigger or enrollment accepts.
Idempotent
Safe to run many times with the same result as running once.
Loose coupling
A design where parts of a system work without knowing details about each other.
Orchestration
A style where a central coordinator directs each step of a process.
Pipeline
In the advanced edition, the path from a matched event to a destination, with optional reshaping.
Polling
Repeatedly checking whether something has changed, the opposite of reacting to events.
Producer
The source in which something happens and which announces it.
Retry
Repeating a failed delivery after a wait.
Router
The middle layer that receives events and forwards them to interested destinations.
Service account
The identity used to receive events and call destinations safely.
Transformation
Reshaping an event on the way to its destination.
Trigger
In the standard edition, a rule that connects event filters to one destination.
Workflow
A defined series of steps run by the Workflows service, often started by an event.
42Frequently Asked Questions
Pub/Sub is a general messaging and streaming service that carries messages between systems at large scale. Eventarc is an event routing service that receives events from many sources, filters them and delivers them in a standard format to destinations. The standard edition even uses Pub/Sub as transport behind the scenes.
Not guaranteed. Delivery is at least once, so duplicates can happen after retries or lost confirmations. Write idempotent handlers that use the event id or a natural key so that a repeated event causes no harm.
No. Ordering is not guaranteed, especially when retries occur. Use event times or version numbers in the data, and ignore events that are older than the current state of the record.
Common destinations are Cloud Run services, Cloud Run functions, Workflows, services in GKE and internal web endpoints inside your network. With the advanced edition, events can also go to other targets such as a Pub/Sub topic or another bus.
Consider it when you want a shared bus for several teams, when your own applications publish custom events, when one event must reach several destinations, or when you want to reshape events inside the pipeline. For a simple link from one source to one service, the standard edition is usually enough.
Common causes are a location that does not match the source, filters that do not match the real event type or resource, missing permissions, required logs or APIs not enabled, or the source not producing the event at all. Check each step from source to destination in order.
Pause or delete the trigger first to stop the flow. Then fix the design: write outputs to a different bucket or folder, filter so that the handler ignores its own outputs and set limits on instances and budgets as a safety net.
Return an error for temporary problems so that delivery is retried. For permanent problems, such as malformed data, record the event and the reason in a separate store, alert a human and return success so that it is not retried pointlessly.
It integrates with IAM and uses signed identity tokens for delivery, but you must configure it well. Use dedicated service accounts with minimal roles, require authentication on destinations, keep sensitive data out of event payloads and audit changes to triggers and buses.
Pricing depends on the edition and event type and can change, so check the official page. Remember the whole chain: events, transport, audit logging, destination compute, storage and network. Filters, loop prevention and budget alerts keep the total under control.
Yes, with the advanced edition your applications can publish custom events to a message bus. Define clear event contracts, name events as facts in the past tense, keep payloads small and let consumers subscribe through enrollments.
Use a direct handler for one short action that is easy to retry. Use a workflow when there are several ordered steps, branching, waiting or the need for clear progress records and partial retries. Eventarc can start either one.
43Summary and Key Takeaways
Eventarc is Google Cloud’s managed service for building event-driven systems. It receives events from Google Cloud services, audit logs, Pub/Sub, partners and your own applications, filters them, and delivers them in the standard CloudEvents format to destinations such as Cloud Run, functions, Workflows, GKE services and private endpoints. The standard edition connects events to destinations with triggers. The advanced edition adds buses, enrollments and pipelines for fan-out, custom events and reshaping. Delivery is at least once and unordered, so reliable systems use idempotent handlers, careful error handling, precise filters, strong identity, loop protection, observability and clear event contracts.
Remember the dispatch center from the beginning: the dispatcher does not fix the fire. The dispatcher notices each call, reads it, applies a rule and sends the right responder. Your job is to write good rules, train good responders and watch the board.
A short self-check for your own system
Ask yourself a few questions. Can every handler safely run twice for the same event? Do outputs ever land where they could retrigger their own handler? Are destinations closed to unauthenticated calls, with a dedicated service account for each trigger? Do you retry only temporary failures and record permanent ones? Would you notice within an hour if a trigger went silent? Is there a catalog that says who produces and who consumes each event type? If any answer is uncertain, begin there.
Pick one small, safe use case and build it end to end: one trigger, one handler with idempotency, one dashboard and one alert for silence. Run duplicate, reversed and failing events through it in a test project. When that single flow is calm and understood, repeat the pattern for the next one.
Key Takeaways
- Events replace polling — the source announces the change, Eventarc filters and routes it, and consumers react without constantly checking.
- Two editions, one idea — standard triggers link events to one destination, while the advanced edition adds buses, enrollments and pipelines for fan-out and custom events.
- CloudEvents gives one envelope — read the standard attributes first, then the data, and use the event id and source for duplicate detection.
- Assume duplicates and disorder — delivery is at least once and unordered, so write idempotent handlers and ignore stale events.
- Secure every hop — dedicated service accounts, least-privilege roles, authenticated destinations and no sensitive data in payloads.
- Handle failure on purpose — retry temporary errors, record permanent ones, separate inputs from outputs to prevent loops and use workflows for multi-step processes.
- Make it visible and governed — log event ids, watch volume, delay and silence, keep configuration as code and maintain a catalog of event contracts.