You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ResetConsumerAsync(stream, consumer, seq=0, ct) on INatsJSContext to call $JS.API.CONSUMER.RESET.<stream>.<consumer> (ADR-60, server v2.14+). Empty-body request rewinds to the ack floor; a non-zero seq reset sets the ack floor stream sequence one below the requested sequence. The response is a ConsumerInfo superset with reset_seq (the next deliverable stream sequence the consumer was reset to).
Review for async/await correctness and cancellation token propagation
Review API surface and backward compatibility
Review NATS protocol correctness
Post review summary
The implementation is clean and consistent with how PauseConsumerAsync / UnpinConsumerAsync are structured. One real concern, everything else is fine:
{} vs empty body for seq=0 (minor spec conformance issue)
ADR-60 says the ack-floor-reset path uses an empty body. When seq == 0, new ConsumerResetRequest { Seq = 0 } serializes to {} (the Seq field is suppressed by WhenWritingDefault, leaving an empty JSON object). That's not the same as 0 bytes on the wire. ResumeConsumerAsync uses request: null to achieve a true empty body. In practice the server almost certainly handles {} the same way, but aligning with the spec is straightforward — see the inline suggestion on NatsJSContext.Consumers.cs line 195. Fix this →
Everything else looks good:
Async/await pattern and CancellationToken propagation match the rest of the file
ThrowIfInvalidStreamName validation is consistent with peer methods; consumer-name validation is intentionally absent (no other method does it)
ConsumerResetRequest (internal) / ConsumerResetResponse (public) visibility split is correct
SkipIfNatsServer extends FactAttribute — the test is properly registered
[Range(ulong.MinValue, ulong.MaxValue)] and [JsonIgnore(Never)] annotations are consistent with the schema-derived style used throughout the Models directory
Serializer registration in NatsJSJsonSerializerContext is correct and in alphabetical order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
ResetConsumerAsync(stream, consumer, seq=0, ct)onINatsJSContextto call$JS.API.CONSUMER.RESET.<stream>.<consumer>(ADR-60, server v2.14+). Empty-body request rewinds to the ack floor; a non-zeroseqreset sets the ack floor stream sequence one below the requested sequence. The response is aConsumerInfosuperset withreset_seq(the next deliverable stream sequence the consumer was reset to).