What it is
In publish subscribe a producer sends a message to a named topic rather than to a specific receiver. Any number of subscribers that registered interest in that topic receive a copy. The producer never knows who is listening, which keeps the two sides decoupled.
Why realtime systems use it
- It lets one event reach many consumers without the producer fanning out by hand.
- It absorbs bursts because the broker buffers between fast producers and slow consumers.
- New subscribers can join a topic without changing the producer.
How a message flows
A chat message published to a room topic is delivered to every connected subscriber of that room.
Practical concerns
- Choose a delivery guarantee such as at least once or at most once per topic.
- Partition busy topics by key so load spreads across brokers.
- Decide whether late subscribers see history or only new messages.
Key idea
Publish subscribe routes messages through topics, letting one event reach many subscribers while keeping producers and consumers fully decoupled.