What happens to a message published on a channel if there are currently no subscribers listening to that channel?
Short answer
If no client is currently subscribed to a channel when a message is published, that message is simply lost forever and never delivered to anyone, since Redis Pub/Sub does not store or queue messages for later delivery, which is an important limitation to understand before…
Advertisement
AModel answer
If no client is currently subscribed to a channel when a message is published, that message is simply lost forever and never delivered to anyone, since Redis Pub/Sub does not store or queue messages for later delivery, which is an important limitation to understand before relying on Pub/Sub for anything that requires guaranteed delivery.
Example
PUBLISH orders 'New order 456' -- lost if no subscribers are currently listening
Real-world example
A team initially used Pub/Sub for order notifications, then discovered orders were being silently missed whenever their notification service briefly restarted, prompting them to switch to Redis Streams for guaranteed delivery instead.
Likely follow-ups
- What alternative Redis feature provides message persistence and guaranteed delivery?
- How do you detect if messages are being missed due to no active subscribers?
Related topics