I am working on a scenario where i have multiple subscribers in Redis pub/sub implementation, but instead of broadcasting the message to all the subscribers i want to deliver a particular message to a single subscriber so that each subscriber will have unique message with them. In this scenario Round-Robin approach seems more reliable. How can we achieve this in Redis?
Asked
Active
Viewed 3,965 times
1 Answers
6
Instead of PubSub, use a List to store messages by calling RPUSH
. Clients can use BLPOP
to atomically and exclusively consume the messages.
Note that this queue pattern doesn't necessarily mean true round-robin-ness, but it should converge to a similar result in most cases.

Itamar Haber
- 47,336
- 7
- 91
- 117