-
Notifications
You must be signed in to change notification settings - Fork 23.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] Support fan-out/multicast (PUBLISH to multiple channels) #13327
Comments
what if using lua script to publish message to a channel list? which can avoids the round-trips. |
Definitely possible, but this should be built in for speed. Most other message queue platforms support fan-out. |
@lukehutch in this case i recommend using stream instead of pubsub, as stream supports fan-out. |
OK, I didn't know that... but streams are a fundamentally different messaging model, so I will probably have a hard time convincing the upstream library I depend upon to switch from pub/sub to streams. Is there a fundamental reason why fan-out is not supported for pub/sub? |
@lukehutch pubsub is not a message queue, it is a simple subscribe and publish, and it is more appropriate to use stream in your scenario. |
The problem/use-case that the feature addresses
I need to be able to send a message to multiple channels. Currently I loop through the channels and send a PUBLISH command for each channel, which can result in a lot of round-trips to the server.
To give more specific usecase details: a user can be a member of potentially hundreds of chat channels in the history of using my app. Rather than subscribe every online user to every chat channel in their inbox every time they go online, I have chosen to subscribe users to just one chat channel, associated with their user id. Now when a message is sent to a chat channel with multiple users, I need to multicast the message to all users who are members of that chat channel.
Description of the feature
I would like a PUBLISH_MULTIPLE command that will take a list of channels, and publish to all of them.
Alternatives you've considered
Instead, I could SUBSCRIBE each user to the channel id of all chat channels in their chat history, and just send new messages once to the intended channel, but I am worried about how well that will scale, with potentially millions of users, each with potentially hundreds of chat channels (most of which have not had any new messages in a long time).
The text was updated successfully, but these errors were encountered: