fix(nats source): defer JetStream acks until delivery - #26217
Draft
horjulf wants to merge 1 commit into
Draft
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The JetStream NATS source currently acknowledges a broker message immediately after
send_batchhands decoded events to the internal topology. That remains ahead of actual sink delivery even when end-to-end acknowledgements are enabled, so a Vector crash can lose an already-ACKed message that was still buffered downstream.This draft makes JetStream participate in the existing batch-finalizer framework:
BatchNotifierto all events decoded from a NATS message;Delivered;ErroredorRejectedbatches so JetStream redelivers them;The source requires an
explicitJetStream consumer acknowledgement policy when end-to-end acknowledgements are active. An unordered downstream completion paired with cumulativeallacknowledgements could otherwise acknowledge an earlier failed message.References
No existing NATS acknowledgement issue found. Opening this as a draft for design feedback, particularly around NAK pacing and whether periodic progress ACKs should be added for delivery times longer than the consumer
ack_wait.Vector configuration
How did you test this PR?
make check-clippy— all workspace targets and features.make test FEATURES=nats-integration-tests SCOPE=nats_jetstream_against a local NATS JetStream 2.14.5 server — 7/7 tests passed.make check-fmt.make check-markdown.make check-changelog-fragments.make check-generated-docs— 248 component examples validated.Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.AI assistance: OpenAI GPT-5.6 Codex was used to help implement and validate this change. The resulting behavior was verified against the source acknowledgement framework and a real JetStream server.