Back to glossary

Pub/Sub (Publish-Subscribe)

A messaging pattern where publishers broadcast messages to topics without knowledge of subscribers, and subscribers receive messages from topics they have registered interest in, enabling loose coupling.

Pub/Sub decouples message producers from consumers through an intermediary topic. Publishers send messages to a named topic without knowing who will consume them. Subscribers register interest in specific topics and receive all messages published to those topics. Multiple subscribers can independently consume the same messages, each processing them differently.

Unlike point-to-point message queues where each message is consumed by exactly one consumer, pub/sub delivers each message to all subscribers of a topic. This fan-out pattern is ideal for broadcasting events that multiple systems need to process: a user signup event might simultaneously trigger a welcome email, analytics tracking, CRM update, and onboarding workflow.

For AI and growth systems, pub/sub enables real-time event processing at scale. User behavior events published to a topic can simultaneously feed a real-time feature pipeline, an analytics aggregation service, a recommendation model update, and a fraud detection system. Google Cloud Pub/Sub, AWS SNS, and Apache Kafka all support this pattern with different trade-offs in delivery guarantees and throughput.

Related Terms