May 27, 2026

Pub/sub messaging explained: pattern and use cases

Reading time :  
4
 min
Aymeric Zhuo
Aymeric Zhuo

Pub/sub messaging explained

Pub/sub (publish-subscribe) is a messaging pattern where senders (publishers) broadcast messages to a topic without knowing who will receive them, and receivers (subscribers) listen to topics they care about without knowing who sent the messages. A message broker sits between them handling delivery. This differs from point-to-point message queues: in pub/sub, each message goes to every subscriber (fan-out pattern).

How pub/sub works

Publishers produce messages and send them to a named topic without caring how many subscribers exist. Topics are named channels that categorize messages. Subscribers register interest in one or more topics and receive a copy of each message. Delivery can be push (broker sends to subscriber) or pull (subscriber polls).

Pub/sub technologies

Google Cloud Pub/Sub: Fully managed, globally distributed, processes over 500 billion messages per day. AWS SNS + SQS: SNS for fan-out, SQS for queuing. Apache Kafka: Persistent, replayable log for event sourcing and stream processing. Redis Pub/Sub: Lightweight, in-memory; no persistence (if a subscriber is offline, it misses the message).

Pub/sub in automation workflows

A webhook from Stripe triggers a CodeWords workflow that processes the event and publishes results to multiple downstream systems — effectively converting a webhook into a pub/sub fan-out. Use pub/sub when multiple systems need to react to the same event independently. Explore CodeWords templates →

Contents
Ready to try CodeWords?
Get started free
Sign in
Sign in