What is Publish-subscribe (pub/sub)?

Publish-subscribe is a messaging pattern where producers publish events to a topic and any number of independent subscribers receive them, decoupling senders from receivers so systems can fan out events cleanly.

Publish-subscribe (pub/sub) is a messaging pattern in which senders, called publishers, emit messages to a named topic without knowing or caring who will read them, and any number of subscribers register interest in that topic and receive every message published to it. This is the key difference from a plain message queue: a queue delivers each message to exactly one consumer (work distribution), whereas pub/sub fans the same message out to all interested subscribers (event broadcast). The decoupling is the whole point, a publisher can be added or removed without touching subscribers, and new subscribers can start consuming an event stream without the publisher ever being modified, which makes pub/sub the backbone of event-driven architectures. Common uses include cache invalidation, real-time notifications, audit logging, and feeding multiple downstream systems from a single source event. Implementations range from Redis pub/sub and Google Cloud Pub/Sub to Kafka topics and webhooks at the API layer. Tradeoffs include delivery guarantees (at-most-once vs at-least-once), ordering, and the operational care needed so a slow subscriber does not fall behind. For an AI agent integrating with an event-driven system, knowing which topics exist and what each event means is durable architectural knowledge well suited to a shared memory store.