Skip to content
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

Added support for NOACK in the StreamReadGroup methods. #1154

Merged
merged 3 commits into from
Feb 3, 2020

Conversation

ttingen
Copy link
Contributor

@ttingen ttingen commented May 29, 2019

The StreamReadGroup methods were updated to include a noAck parameter that defaults to false. When true, the NOACK option is sent with the XREADGROUP command. According to the documentation, this is the equivalent of acknowledging the message when it is read and the message will not be added to the pending message list.

Tests were also added to verify that messages are not added to the pending message list when this option is used.

@mgravell
Copy link
Collaborator

Adding an optional parameter (bool noAck = false) is a breaking change that will result in MissingMethodException errors. Given that we've recently done a "major", I'm not in a hurry to force another major - so: we'll need to do it another way. This is usually done by adding an overload.

The question then becomes:

  1. add a bool
  2. add a new [Flags] enum, enabling scope for additional options later
  3. (ab)use CommandFlags by adding one there

I think 2 would probably be the safest option, but I'm open to other options.

Copy link
Collaborator

@mgravell mgravell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be implemented as an overload, not a breaking (non-binary-compatible) change to the existing signature

@ttingen
Copy link
Contributor Author

ttingen commented May 30, 2019

Thanks Marc, I will update the change to be an overload. It looks like I need to make the same change for #1141 as well.

@mgravell
Copy link
Collaborator

Yes,same thing there. Comment added.

@mgravell
Copy link
Collaborator

mgravell commented May 30, 2019

Note on making this change: the usual pattern when there are existing optional parameters is to make the old version non-optional throughout, i.e.

from:

Whatever SomeMethod(int a, string b, float? c = null, SomeEnum d = SomeEnum.None)
{...}

to

Whatever SomeMethod(int a, string b, float? c, SomeEnum d)
    => SomeMethod(a, b, c, blah, d);

Whatever SomeMethod(int a, string b, float? c = null, NewArgHere yay = blah, SomeEnum d = SomeEnum.None)
{...}

This minimizes problems due to ambiguous method resolution, while ensuring that old code a: compiles, and b: continues to execute without compiling. Additionally, newly compiled code will almost always pick the new method, avoiding a stack-frame (which may or may not be inlined by the JIT).

@ttingen
Copy link
Contributor Author

ttingen commented Jun 15, 2019

Apologies for the delay in getting this done...summer vacation, work, etc...

I will take care of the overload for the MKSTREAM option as well. Thanks Marc!

@mgravell
Copy link
Collaborator

mgravell commented Feb 3, 2020

Merging, thanks

@mgravell mgravell merged commit c7e7637 into StackExchange:master Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants