Chapter Five
Messaging & Async
When components stop calling each other directly, they exchange messages, schedule work, orchestrate steps, and react to events. Five services for the decoupling work that makes a real distributed system tractable.
The decisions in this chapter shape how a system holds together at the seams. Choosing Pub/Sub where Cloud Tasks is the right tool, or hand-rolling orchestration with chained Pub/Sub messages instead of Workflows, leads to brittle architectures that resist debugging. Each of these five services has a narrow niche; learning the niches matters as much as learning the APIs.
One message fans out to many independent subscriptions (topics → subscriptions)→
Pub/Sub
Deliver tasks to one target (HTTP or App Engine), rate-limited with retries→
Cloud Tasks
Trigger work on a schedule (cron)→
Cloud Scheduler
Coordinate a multi-step sequence with state and error handling→
Cloud Workflows
Route events from Google Cloud, SaaS, or custom (CloudEvents) sources to handlers→
Eventarc
Services in This Chapter
Service 23
Pub/Sub
Global messaging service. Topics and subscriptions, push and pull delivery, at-least-once with optional exactly-once, ordering keys, dead letter topics, schemas.
Service 24
Cloud Tasks
Managed task queue for rate-limited HTTP work with retries. The right tool when Pub/Sub fan-out is not what you need.
Service 25
Cloud Scheduler
Managed cron. HTTP, Pub/Sub, and App Engine targets with retry policies and timezone-aware schedules.
Service 26
Cloud Workflows
Serverless orchestration. YAML-defined state machines with native GCP connectors, error handling, parallel steps, and long-running executions.
Service 27
Eventarc
Event router. Triggers Cloud Run, Cloud Functions, GKE, and Workflows from 90+ GCP event sources in the CloudEvents format.