feat: batch enqueue, delivery batching, and smart batching modes#3
Merged
vieiralucas merged 1 commit intomainfrom Mar 24, 2026
Merged
feat: batch enqueue, delivery batching, and smart batching modes#3vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
add explicit batchEnqueue() method, transparent delivery batching in consume stream (unpacks repeated messages field with singular fallback), and three BatchMode options: AUTO (opportunistic, default), LINGER (timer-based), and DISABLED. enqueue() now routes through the batcher by default. single-item optimization uses regular Enqueue RPC for exact error semantics. close() drains pending messages before disconnecting.
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
batchEnqueue(List<EnqueueMessage>)method for explicit batch enqueue viaBatchEnqueueRPCConsumeResponse.messages(repeated field) with singularmessagefallback for backward compatibilityBatchModewith three modes:AUTO(opportunistic, default),LINGER(timer-based),DISABLEDenqueue()now routes through background batcher by default (zero config, zero latency penalty at low load)EnqueueRPC (preserves exact error types likeQueueNotFoundException), 2+ messages useBatchEnqueueclose()drains pending batched messages before disconnectingBatchEnqueueRPC andConsumeResponse.messagesrepeated fieldTest plan
BatchModeTest-- 7 unit tests for mode configuration and validationBatchEnqueueResultTest-- 4 unit tests for success/error result typesBuilderTest-- 4 new tests for batch mode builder options (11 total)BatchClientTest-- 8 integration tests: explicit batch, mixed queue results, auto batching, linger batching, disabled batching, multi-message consume, error propagation through batcher, default mode verificationGenerated with Claude Code
Summary by cubic
Adds explicit batch enqueue, client-side smart batching for
enqueue(), and delivery batching forconsume(). Default mode is AUTO, which coalesces messages under load without adding latency at low load.New Features
batchEnqueue(List<EnqueueMessage>)with per-messageBatchEnqueueResult.consume()now unpacksConsumeResponse.messageswith singular fallback.BatchMode:AUTO(default),LINGER,DISABLED.enqueue()routes through a background batcher by default; 1 message usesEnqueue, 2+ useBatchEnqueue.close()now drains pending batched messages.BatchEnqueueRPC and batchedConsumeResponse.messages.Migration
BatchEnqueueto benefit from batching; usewithBatchMode(BatchMode.disabled())to stay compatible with older servers.Written for commit d8f1f73. Summary will update on new commits.