Concepts · Concept
Pub/Sub
“Redis Pub/Sub is a lightweight, in-memory publish-subscribe messaging pattern built into Redis. A publisher sends a message to a named channel; every subscriber currently listening to that channel receives it instantly. There’s no persistence — if a subscriber isn’t connected at the moment a message is published, that message is gone forever for them.”
When to reach for it:
- Real-time fan-out to currently-connected clients where losing a message occasionally is acceptable (e.g., broadcasting “user is typing” indicators, live cursor positions in a collaborative doc, simple real-time notifications where a missed one isn’t critical)
- You already have Redis in your stack and want something extremely simple and fast, without standing up a separate messaging system
Its weak spot: no durability, no replay, no delivery guarantees. If your consumer service crashes for even a second, every message published during that gap is lost — nothing is stored, nothing is redelivered. Also no consumer groups or partitioning built in — it’s fire-and-forget broadcast, not a queue.