I haven't been able to find in the documentation on how the messages in a channel get stored in redis publish/subscribe.
When you publish to a redis channel, is that message stored or persisted? If so, how long is it stored and how do you get historical messages?
Otherwise, I'm assuming that it just broadcasts that message and drops/deletes that message after doing so?
More precisely, Redis Pub/Sub is designed for real-time communication between instances where low latency is of the utmost importance, and as such doesn't feature any form of persistence or acknowledgment.
Unlike most Redis operations, which may be written to disk, Redis pub/sub is non-persistent. Published messages are passed directly to subscribers and then dropped, with no record retained in Redis's memory or on disk.
Redis Pub/Sub implements the messaging system where the senders (in redis terminology called publishers) sends the messages while the receivers (subscribers) receive them. The link by which the messages are transferred is called channel. In Redis, a client can subscribe any number of channels.
The Redis pub/sub is not a reliable messaging system. Messages that are not retrieved will be discarded when your client is disconnected or a master/standby switchover occurs.
The pub/sub messages are not queued, and even less persisted.
They are only buffered in the socket buffers, and immediately sent to the subscribers in the same event loop iteration as the publication.
If a subscriber fails to read a message, this message is lost for the subscriber.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With