Pub/Sub
Globally distributed, asynchronous messaging service providing at-least-once message delivery with ultra-low latency.
Globally distributed, asynchronous messaging service providing at-least-once message delivery with ultra-low latency.
What is Pub/Sub?
Google Cloud Pub/Sub is a fully managed, globally available messaging middleware service designed to ingest and distribute millions of events per second with sub-100ms latency. Senders (Publishers) publish messages to Topics without knowing who will receive them; Receivers (Subscribers) consume messages asynchronously from Subscriptions attached to those topics. It natively handles cross-zone and cross-region replication automatically.
Decision Guide: When to Choose This Service
Use Pub/Sub for decoupling microservices, ingesting IoT / clickstream event streams, buffering asynchronous workloads, fan-out event distribution, and feeding real-time pipelines in Dataflow or Cloud Run.
Do NOT use Pub/Sub as a database or long-term persistent event log (use BigQuery or Cloud Storage). For strict FIFO queues with deduplication at low volume, consider Cloud Tasks.
Core Architectural Pillars
Topics are named message feeds; Subscriptions represent a stream of messages from a topic to be consumed.
Pull allows subscribers to control consumption rate via gRPC/REST; Push routes messages to an HTTPS webhook endpoint or BigQuery/Cloud Storage sink directly.
Guarantees every message is delivered to active subscribers at least once (idempotent receivers are recommended).
Forward undeliverable messages after N failed delivery attempts for debugging.
Optional ordering keys deliver messages with the same key in strict FIFO sequence.