100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Cloud

Google Cloud Pub/Sub

By Google Cloud

IntermediateService10K learners

Google Cloud Pub/Sub is a fully managed, globally distributed messaging service that lets applications publish and subscribe to asynchronous event streams at scale.

Definition

Google Cloud Pub/Sub is a fully managed, globally distributed messaging service that lets applications publish and subscribe to asynchronous event streams at scale.

Overview

Pub/Sub implements the classic publish-subscribe pattern as a serverless, globally available service: publishers send messages to a named topic without knowing who, if anyone, will consume them, and one or more subscriptions independently receive a copy of every message published to that topic. This decoupling lets producers and consumers scale, deploy, and fail independently, which is central to building resilient, loosely coupled distributed systems. Each subscription can use either push delivery, where Pub/Sub calls a webhook endpoint, or pull delivery, where a subscriber polls for messages, acknowledging each one once processed. Unacknowledged messages are redelivered, and Pub/Sub guarantees at-least-once delivery; ordering keys and exactly-once delivery modes are available for workloads that need stricter guarantees. Message retention allows subscribers to replay a backlog for a configurable window, which is useful for recovering from downstream outages. Pub/Sub is a foundational building block across Google Cloud, feeding data pipelines built with Dataflow, triggering Cloud Functions and Cloud Run services, and streaming events into BigQuery for analytics. Its design goals overlap with Apache Kafka and Azure Event Grid, but as a fully managed service it removes the operational burden of running and scaling brokers, at the cost of some of the fine-grained control a self-managed Kafka cluster offers.

Key Features

  • Fully managed, serverless publish-subscribe messaging with automatic scaling
  • At-least-once delivery guarantees with optional exactly-once processing
  • Both push (webhook) and pull (polling) subscription delivery models
  • Message ordering keys for use cases that require sequential processing
  • Configurable message retention for replaying a backlog after outages
  • Global availability with low-latency delivery across regions
  • Native integration with Dataflow, Cloud Functions, Cloud Run, and BigQuery
  • Dead-letter topics for isolating messages that repeatedly fail processing

Use Cases

Decoupling microservices through asynchronous event-driven communication
Streaming ingestion pipelines feeding analytics platforms like BigQuery
Triggering serverless functions in response to application events
Distributing real-time notifications to many independent subscribers
Buffering bursty workloads to smooth traffic spikes for downstream systems
Building event sourcing and CQRS architectures
Replicating data changes between services and databases

Alternatives

Frequently Asked Questions

From the Blog