Cloud Pub/Sub is GCP's managed messaging / event ingestion service. Publishers send messages to a topic; subscriptions deliver those messages to subscribers (push or pull).
Services / apps
|
v
Pub/Sub topic --+--> subscription A --> Dataflow
+--> subscription B --> Cloud FunctionPub/Sub properties
- Fully managed; no brokers to run
- At-least-once delivery (design consumers idempotent)
- Fan-out via multiple subscriptions on one topic
- Great front door into Dataflow / BigQuery streaming inserts
Pub/Sub vs Kafka
| Dimension | Pub/Sub | Kafka | |---|---|---| | Model | Topic + subscriptions | Topic + partitions + consumer groups | | Ops | Fully managed GCP | Self-managed or managed Kafka | | Replay | Seek / snapshot patterns; retention limits | First-class log replay via offsets | | Ordering | Per ordering key (optional); not global | Per partition | | Ecosystem | GCP-native | Broad streaming ecosystem | | Best fit | GCP event bus, fan-out, serverless | Durable log, complex stream processing |
Interview tip: "Pub/Sub = managed publish/subscribe on GCP; Kafka = durable partitioned log." Emphasize fan-out subscriptions vs Kafka consumer groups, and always mention idempotent consumers.