Pulsar: acknowledgment-strategy choice (individual / cumulative / batched) (#3180)#3202
Merged
Merged
Conversation
…ched) (#3180) Pulsar analogue of the Kafka CommitMode overhaul (#3150). Adds a per-listener ack strategy: - Individual (default): ack each message as it completes (unchanged behavior). - Cumulative: one ack confirms everything up to a point. Exclusive/Failover only — configuring it on a Shared/Key_Shared subscription throws a clear error at startup. Because the buffered listener completes out of order, the cumulative ack only ever advances to the highest CONTIGUOUS-completed message (PulsarAckHandler tracks in-flight ids and the completed set), so it never acks a still-in-flight message — no silent message loss. - Batched: individual acks flushed by count or interval; no ordering constraint, safe for any subscription type. New PulsarAckHandler encapsulates the three modes; PulsarListener tracks receipts and routes CompleteAsync through it (retry-consumer messages always ack individually) and flushes batched acks on shutdown. Config via AcknowledgeIndividually()/AcknowledgeCumulative()/AcknowledgeInBatches(...). Tests: deterministic handler unit tests (individual, batched-by-count, cumulative out-of-order watermark + in-order), startup rejection of cumulative-on-Shared, and an end-to-end batched delivery test. Docs updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 23, 2026
Closed
This was referenced Jun 29, 2026
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.
Part of the Pulsar re-evaluation epic #3176. Fixes #3180. Builds on #3179.
The Pulsar analogue of the Kafka
CommitModeoverhaul (#3150). Adds a per-listener acknowledgment strategy.Strategies
Cumulative ordering safety (the correctness-sensitive bit)
Wolverine's buffered listener completes messages out of order. A naive cumulative ack of a later message would confirm earlier, still-in-flight ones — silent message loss.
PulsarAckHandlertracks in-flight ids and the completed set, and only ever advances the cumulative ack to the highest contiguous-completed message, so it never acks past in-flight work. This is proven deterministically by a unit test (complete 2 and 3 while 1 is in flight → no ack; complete 1 → single cumulative ack jumps to 3).Changes
PulsarAckStrategyenum +PulsarAckHandler(encapsulates all three modes, watermark logic, batch flush + shutdown flush).PulsarListenertracks receipts and routesCompleteAsyncthrough the handler (retry-consumer messages always ack individually); startup validation for cumulative-on-Shared.PulsarListenerConfiguration.AcknowledgeIndividually() / AcknowledgeCumulative() / AcknowledgeInBatches(size, interval).Tests
Deterministic handler unit tests (individual; batched-by-count; cumulative out-of-order watermark + in-order), startup rejection of cumulative-on-Shared, and an end-to-end batched delivery test. Docs updated.
🤖 Generated with Claude Code