-
Notifications
You must be signed in to change notification settings - Fork 23.9k
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
Change sharded PubSub message type to smessage #10748
Comments
Makes sense to me - @madolson what sayeth thee? |
@leibale Trying to understand the issue. Won't the client be able to figure out based on the command used to |
CC @dvora-h you wanted to track this as well |
@hpatro if one client subscribes to the same channel name using |
@leibale Thanks for the clarification. I also feel we should make this breaking change. Once, the redis-core-team approves, will put up the PR. |
@leibale You can always trivially differentiate them just with custom naming on the channels. However, I think for clients having the separate message allows them to more appropriately route them. (if message, forward to normal listener, if smessage forward to sharded listeners) This seems like a more appropriate fix, and seems acceptable at this point. |
Other than the fact it's a breaking change for something that's already released (maybe it's early enough to afford to break this), maybe for some clients seeing them the same could be beneficial? i.e. if the client library already handles @yossigo please comment too. |
await client.SUBSCRIBE('channel', message => {
console.log('SUBSCRIBE', message);
});
await client.SSUBSCRIBE('channel', message => {
console.log('SSUBSCRIBE', message);
});
await client.PUBLISH('channe', 'message');
what the client should do? throw an error? run both handlers? |
If it's not too late, I think we should change it now, so we don't have to live with this for the rest of our lives. We already have If we don't fix it, clients will need to check both lists of handlers to know which callback(s) to call, which probably works in practice but it's extra complexity for the client. I don't believe cluster clients supporting SUBSCRIBE can support SSUBSCRIBE out of the box. I can see how it can work if the client has a single callback regardless of channel, but that'd be a very simplistic client. |
What is the reason to distinguish between these two message types and why would someone want this distinction? I'm strongly in favor of keeping |
I am also opposed to making a separate By that I mean whether you Let's look at Redis < 7. Why do we keep the callbacks for But what if we have a client that So clients must already deal with the ambiguity of TL;DR: |
@slact i think you may have got one fact wrong, and it seems your main argument builds on that fact.
the fact is that unlike SUBSCRIBE and PSUBSCRIBE that share a channel space (i.e. a let me know what i'm missing. |
@slact This is not true. If you've psubscribed, you get messages on the form of multi-bulk of length 4 with the elements |
Yep, I completely blanked that you really do get a |
interesting, I agree |
so it looks like other than the uncomfortable breaking change, (nearly) everyone agree that it's better to change it. |
Looks like we have a consensus, submitting a PR shortly. |
With the current implementation of sharded PubSub there is no way to distinguish between "regular" and sharded PubSub messages:
Changing "message" to "smessage" will solve the issue, and it follows the same pattern as "message"
The text was updated successfully, but these errors were encountered: