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.

5 services

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.

Pick by the Pattern, Not the API
One message fans out to many independent subscriptions (topics → subscriptions)Pub/Sub
Deliver tasks to one target (HTTP or App Engine), rate-limited with retriesCloud Tasks
Trigger work on a schedule (cron)Cloud Scheduler
Coordinate a multi-step sequence with state and error handlingCloud Workflows
Route events from Google Cloud, SaaS, or custom (CloudEvents) sources to handlersEventarc

Services in This Chapter