Skip to content

Support ADR 60 Ack Policy Flow Control - #1624

Merged
scottf merged 1 commit into
mainfrom
ack-policy-flow-control
Sep 3, 2026
Merged

Support ADR 60 Ack Policy Flow Control#1624
scottf merged 1 commit into
mainfrom
ack-policy-flow-control

Conversation

@scottf

@scottf scottf commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
  1. add AckPolicy FlowControl("flow_control");  FlowControl is the enum name and flow_control is what is actually serialized.

  2. StreamSource and StreamConsumerSource are already supported in Java for quite a while, so nothing to do there.

  3. Java client already processes flow control messages, so again nothing to do there.

  4. Consumer reset already supported and tested 2.14 Reset Consumer #1562

  5. Implement test. Example test is found in the Rust client at https://github.com/nats-io/nats.rs/pull/1581/changes#diff-c9dadc99998c0e5a43970bc3270c8df2f51fa6bf09eccc5aba3e88b17ebe5c6fR4280

@scottf
scottf requested a review from Jarema September 3, 2026 20:09
@synadia-claude-reviewer

synadia-claude-reviewer Bot commented Sep 3, 2026

Copy link
Copy Markdown

Claude finished @scottf's task in 2m 7s —— View job


PR Review: Support ADR 60 Ack Policy Flow Control

  • Gather context and read PR diff
  • Review AckPolicy.java changes
  • Review JetStreamMirrorAndSourcesTests.java changes
  • Post review summary

Summary

The changes are minimal, focused, and correct. The FlowControl enum value follows the exact same pattern as the existing values and will be automatically handled by the existing strEnumHash deserialization lookup with no additional wiring needed.

One inline comment posted on the Javadoc in AckPolicy.java — the description copies Rust-style link syntax ([AckPolicy::All]) which won't render as a hyperlink in JavaDoc. Should be {@link AckPolicy#All}.

Observations

AckPolicy.java

  • The enum value and serialized form ("flow_control") are correct and consistent with the ADR.
  • The static strEnumHash map is populated via values(), so FlowControl is automatically registered for deserialization with no extra code needed. ✓
  • There are no guardrails preventing a user from manually setting AckPolicy.FlowControl on a consumer config. This is consistent with how None/All/Explicit work — the server will reject invalid combinations — so this is fine.

JetStreamMirrorAndSourcesTests.java

  • The test is correctly gated on atLeast2_14().
  • It verifies the ConsumerSource (name + deliverSubject) round-trips correctly through both the addStream response and a subsequent getStreamInfo call, which is the right thing to check.
  • The test intentionally does not assert AckPolicy.FlowControl on the server-managed consumer directly, which is consistent with the PR description noting that server-managed consumer handling is already covered.
  • There is no unit-level test for AckPolicy.get("flow_control") deserialization, but the mechanism is identical to the other three values so the risk is low.

Overall this is a clean, low-risk addition.

Explicit("explicit"),
/**
* Used by server-managed durable sourcing/mirroring consumers (ADR-60).
* Behaves like [`AckPolicy::All`] but acknowledgements are driven by

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Javadoc here uses Rust-style link syntax. Java Javadoc won't render [AckPolicy::All] as a hyperlink. Consider using the Java equivalent:

Suggested change
* Behaves like [`AckPolicy::All`] but acknowledgements are driven by
* Behaves like {@link AckPolicy#All} but acknowledgements are driven by

@Jarema Jarema left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@scottf
scottf merged commit f83ba05 into main Sep 3, 2026
11 checks passed
@scottf
scottf deleted the ack-policy-flow-control branch September 3, 2026 23:37
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.

2 participants