What is Google Cloud Pub/Sub?
Google Cloud Pub/Sub implements a publish–subscribe messaging model that decouples producers and consumers to enable scalable, reliable event-driven systems:- Publishers produce messages and send them to a named resource called a topic.
- Topics durably store and route messages.
- Subscribers consume messages from a subscription attached to the topic and process them (for example, by writing to BigQuery or triggering Cloud Functions).
Common architecture patterns
Below are the canonical Pub/Sub patterns you’ll encounter when designing ingestion or streaming systems. Each pattern has different implications for scaling, ordering, and routing.One-to-one setup
A single publisher sends messages to a topic and a single subscriber consumes them. This is the simplest pattern: one producer → one topic → one consumer. Useful for straightforward point-to-point messaging.
One-to-many (fan-out)
Fan-out lets a single publisher send messages to one topic while multiple independent subscribers consume identical copies of each message. This pattern supports parallel downstream use cases (analytics, notifications, inventory updates) without coupling them together.
Many-to-many
Multiple publishers publish into a shared topic and multiple subscribers independently process those messages for different purposes. This is common in high-scale systems like gaming platforms where many producers generate events consumed by analytics, monitoring, and security pipelines.
Many-to-one
Many producers send events into a topic but a single subscriber consumes them (for example, one real-time analytics engine). This centralizes processing while preserving distributed production. All of these patterns affect how you design for throughput, message ordering, retries, and error handling (e.g., dead-letter topics).Pattern comparison
| Pattern | Description | Typical use case |
|---|---|---|
| One-to-one | Single publisher → single topic → single subscriber | Simple point-to-point messaging, low complexity |
| One-to-many (fan-out) | Single publisher → single topic → multiple subscribers | Broadcast events to analytics, alerts, and services |
| Many-to-many | Multiple publishers → single topic → multiple subscribers | High-scale event systems with diverse consumers |
| Many-to-one | Multiple publishers → single topic → single subscriber | Centralized processing (e.g., real-time analytics) |
Exam-focused summary
Remember these core exam concepts:- Topic — a named Pub/Sub resource to which publishers send messages. Topics are used for real-time analytics, data-pipeline integration, and decoupling services across your architecture.

Key subscription points for the exam: subscriptions define how messages are delivered. Pub/Sub supports pull subscriptions (the subscriber polls for messages) and push subscriptions (Pub/Sub delivers messages to an HTTPS endpoint). Messages must be acknowledged; Pub/Sub guarantees at-least-once delivery (duplicates can occur), and the default ack deadline is 10 seconds (which can be extended).
Subscriptions and delivery modes
- Pull subscriptions: Subscribers explicitly poll Pub/Sub for messages when they are ready to process them. This model is common for managed processing frameworks (for example, Dataflow) or custom worker fleets that control their own concurrency and backpressure.
- Push subscriptions: Pub/Sub sends messages to a subscriber endpoint (HTTP/HTTPS). Use this when your consumer is a stateless web service that can accept inbound requests.
- Acknowledgement (ack) deadlines — default is 10 seconds; you can extend the deadline while processing.
- At-least-once delivery — consumers must be idempotent or deduplicate messages to handle duplicates.
- Ordering keys — preserve ordering for messages with the same key.
- Dead-letter topics — route undeliverable or repeatedly failing messages for inspection and recovery.
Next steps
Now that you understand the Pub/Sub model, common patterns, and exam-relevant details, practice creating topics and subscriptions, experiment with pull vs. push delivery, and implement idempotent consumers. Hands-on experience (for example, sending messages with the gcloud CLI or a client library and observing ack behavior) will reinforce these concepts.Links and references
- Google Cloud Pub/Sub documentation
- BigQuery documentation
- Cloud Functions documentation
- Dataflow documentation