You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two or more groups of consumer servers subscribed to a channel. When producer server publish a message, I'd like one and only one consumer server in each group get the message.
I need this because the consumer servers are actually load balanced and running different tasks. This feature is important in a scalable network.
I suggest to have a group identity when consumer server subscribe the channel, gid=0 means ungrouped. Then only one server get the notification in one group.
You can use a list as message queue instead. Have the publishers push a message to this list, and have clients doing a blocking pop from it. This way, every message will only end up with one client.
I suggest what Pieter said. Basically in Redis we have two models for messaging:
Pub/Sub that is many-to-may and fire-and-forget (no persistence).
Lists: many to N competing listeners, with persistence, optional reliability (BRPOPLPUSH), and so forth.
We'll try hard to avoid making the semantics more complex trying to create new messaging systems having mixed properties between the former and the latter. When more complex messaging is needed either use a full featured messaging system like RabbitMQ or ask yourself if you can relax the requirements...
@antirez is there a way to do competing listeners on "Keyspace Notifications" ?
I mean, I need a way for only one of my listeners to be able to handle an EXPIRE notification but as far as I can see there's only the option listen to these notifications using the pub/sub mechanism.
Activity
pietern commentedon Nov 21, 2011
You can use a list as message queue instead. Have the publishers push a message to this list, and have clients doing a blocking pop from it. This way, every message will only end up with one client.
antirez commentedon Nov 22, 2011
I suggest what Pieter said. Basically in Redis we have two models for messaging:
We'll try hard to avoid making the semantics more complex trying to create new messaging systems having mixed properties between the former and the latter. When more complex messaging is needed either use a full featured messaging system like RabbitMQ or ask yourself if you can relax the requirements...
Closing
refaelos commentedon Oct 11, 2014
@antirez is there a way to do competing listeners on "Keyspace Notifications" ?
I mean, I need a way for only one of my listeners to be able to handle an EXPIRE notification but as far as I can see there's only the option listen to these notifications using the pub/sub mechanism.
Merge pull request redis#202 from Cyan4973/xxh3