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

Ordered consumer changes #376

Merged
merged 3 commits into from
Sep 29, 2022
Merged

Ordered consumer changes #376

merged 3 commits into from
Sep 29, 2022

Conversation

aricart
Copy link
Member

@aricart aricart commented Sep 29, 2022

  • [CHANGE] [JS] ordered consumers now default to memory storage and no replicas

  • [CHANGE] [JS] ordered consumers now recreate the consumer if heartbeats are missed. Note that the client will not get a notification since the client will try to recover. This is also a change for iterators since the ordered consumer iterator will now resume when the consumer
    is recreated. For non-ordered consumers, any error will be notified on the callback until the subcription ends. Iterator based consumers will stop with the missed heartbeat error.

  • [FIX] [JS] publishing retries now properly handle timeouts

FIX #375

nats-base-client/jsclient.ts Outdated Show resolved Hide resolved
nats-base-client/jsclient.ts Show resolved Hide resolved
return false;
}
// reset the consumer
const seq = this.info?.ordered_consumer_sequence?.delivery_seq;
Copy link
Member Author

Choose a reason for hiding this comment

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

this is possibly not right either - the sequence if we have one, should be incremeted

@aricart aricart temporarily deployed to CI September 29, 2022 17:18 Inactive
return false;
}
// reset the consumer
const seq = this.info?.ordered_consumer_sequence?.delivery_seq || 0;
Copy link
Member

Choose a reason for hiding this comment

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

The sequence needs to be the stream sequence, not the consumer sequence.

Copy link
Member

Choose a reason for hiding this comment

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

That is, the library needs to keep track of the stream sequence in the message's reply (the meta data) and when resetting, need to reset at that sequence + 1.

Copy link
Member Author

@aricart aricart Sep 29, 2022

Choose a reason for hiding this comment

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

good catch -fixed

@aricart aricart temporarily deployed to CI September 29, 2022 18:54 Inactive
@aricart aricart requested a review from kozlovic September 29, 2022 19:09
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

@aricart aricart merged commit 86719fe into main Sep 29, 2022
@aricart aricart deleted the fix-375 branch September 29, 2022 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ordered consumers need to be recreated when heartbeats fail
2 participants