Back to Data & Analytics

Pub/Sub

gcp

Globally distributed, asynchronous messaging service providing at-least-once message delivery with ultra-low latency.

DATA & ANALYTICS
Google Cloud Platform

Globally distributed, asynchronous messaging service providing at-least-once message delivery with ultra-low latency.

Click any section above to jump directly to it

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

When to Use Pub/Sub

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.

When NOT to Use (Recommended Alternatives)

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 & Subscriptions

Topics are named message feeds; Subscriptions represent a stream of messages from a topic to be consumed.

Push vs Pull Delivery

Pull allows subscribers to control consumption rate via gRPC/REST; Push routes messages to an HTTPS webhook endpoint or BigQuery/Cloud Storage sink directly.

At-Least-Once Delivery

Guarantees every message is delivered to active subscribers at least once (idempotent receivers are recommended).

Dead Letter Topics

Forward undeliverable messages after N failed delivery attempts for debugging.

Message Ordering

Optional ordering keys deliver messages with the same key in strict FIFO sequence.