fix(sqs-batch-manager): use original queueUrl instead of batchKey in batch requests#6798
Open
anuq wants to merge 2 commits intoaws:masterfrom
Open
fix(sqs-batch-manager): use original queueUrl instead of batchKey in batch requests#6798anuq wants to merge 2 commits intoaws:masterfrom
anuq wants to merge 2 commits intoaws:masterfrom
Conversation
…batch requests When a request has an overrideConfiguration, getBatchKey() returns queueUrl + overrideConfig.hashCode() as a composite key to correctly group requests for batching. However, createXxxBatchRequest() was passing this composite key as the QueueUrl in the actual SQS API call, producing a non-existent URL like: https://sqs.us-west-2.amazonaws.com/123/my-queue-461286369 This causes QueueDoesNotExistException for any caller that sets an overrideConfiguration on their request (e.g. the SQS extended client library which appends a user-agent via overrideConfiguration). Fix: extract queueUrl from the first request in the batch (safe because all requests in a batch share the same queueUrl by grouping invariant) and use that for the QueueUrl field in the batch API call. Affected: SendMessageBatchManager, DeleteMessageBatchManager, ChangeMessageVisibilityBatchManager. Fixes aws#6478
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.
Problem
Fixes #6478
When a
SendMessageRequest,DeleteMessageRequest, orChangeMessageVisibilityRequesthas anoverrideConfigurationset,getBatchKey()correctly returnsqueueUrl + overrideConfig.hashCode()as a composite key to group requests for batching. However,createXxxBatchRequest()was using this same composite string as theQueueUrlin the actual SQS API call, producing a non-existent URL like:This causes
QueueDoesNotExistExceptionfor any caller that sets anoverrideConfigurationon their request — notably the SQS extended client library which appends a user-agent string viaoverrideConfiguration.Fix
Extract
queueUrlfromidentifiedRequests.get(0).message().queueUrl()(safe because all requests in a batch share the samequeueUrlby the grouping invariant) and use that instead ofbatchKeyfor theQueueUrlfield in the batch API call.Affected classes:
SendMessageBatchManagerDeleteMessageBatchManagerChangeMessageVisibilityBatchManagerTesting
Added regression tests to
BaseSqsBatchManagerTestfor all three operations that verify the WireMock-captured request body contains the originalQueueUrl(not the hash-suffixed batchKey) whenoverrideConfigurationis set.Checklist
#6478)./mvnw packagesucceeds