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

Change ConsumerConfig constructor to always set default AckPolicy #490

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hanlong-chen-1047
Copy link

@hanlong-chen-1047 hanlong-chen-1047 commented Apr 24, 2024

Currently the no-args constructor for ConsumerConfig does not set the AckPolicy for the consumer, which defaults it to None. This is confusing given that the NATS docs state that the default AckPolicy is Explicit:
https://docs.nats.io/nats-concepts/jetstream/consumers#ackpolicy

This has led to unexpected behaviors since we had expected this to be set to Explicit by default for all consumers.

This PR changes the no-args ConsumerConfig constructor to set the AckPolicy to Explicit, to be the same as the constructor with a durable name.

@mtmk mtmk self-assigned this Apr 24, 2024
@mtmk mtmk added the breaking label Apr 24, 2024
@mtmk
Copy link
Collaborator

mtmk commented Apr 24, 2024

This sounds like a sensible thing to do actually (potentially related discussions)

cc @robertmircea

@caleblloyd
Copy link
Contributor

Should we consider changing the default value of the enum ConsumerConfigAckPolicy to Explicit instead of None?

@mtmk
Copy link
Collaborator

mtmk commented Apr 25, 2024

Should we consider changing the default value of the enum ConsumerConfigAckPolicy to Explicit instead of None?

it might make more sense for other scenarios as well e.g.

    AckPolicy = default,

Edit: @hanlong-chen-1047 are you also happy with this suggestion? (I can make the change if you don't have time, not to worry)

@robertmircea
Copy link

robertmircea commented Apr 25, 2024 via email

@mtmk
Copy link
Collaborator

mtmk commented May 1, 2024

looking at this closer enum:

public enum ConsumerConfigAckPolicy
{
    Explicit = 0, // <--- hurts my eyes
    All = 1,
    None = 2,
}

...having None = 0 is more conventional and it's aligned with how the server is working on the wire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants