mardi 30 août 2016

Redis pub sub for multiple producers and multiple consumers

Lets say there are N producers and M users which subscribes to these N producers. Here N producer produce N different types of messages e.g

producer1 produces  messageType1, 
producer2 produces  messageType2,
producer3 produces  messageType3,
.
.
. 
producerN produces  messageTypeN. 

M users can subscribe to these messages. One user can subscribe to multiple types of messages. E.g.

user1 consumes (messageType1, messageType2, messageType10)
user2 consumes (messageType14, messageType5)
.
.
userM consumes (messageType21, messageType22, messageType23, .... messageTypeN)

Users may consume same or distinct message types. My questions is how to design this scenario. It looks like pub sub pattern. For this scenario, do I have to create channels per user in redis. If yes, there is a limitation on number of redis channel one can create (10K). In that case how to handle millions of user? Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire