fix(sqs): use queue-level VisibilityTimeout as fallback in ReceiveMes…#413
Merged
hectorvent merged 1 commit intofloci-io:mainfrom Apr 13, 2026
Conversation
…sage When ReceiveMessage does not specify a VisibilityTimeout parameter, doReceiveMessage falls back to the global default (30s) instead of the queue's own VisibilityTimeout attribute. This causes messages to stay invisible far longer than expected, which in turn breaks DLQ redrive for queues configured with a short visibility timeout — the message never becomes visible within a reasonable window for the receive-count check to trigger. Read the queue's VisibilityTimeout attribute as the intermediate fallback before using the global default.
Collaborator
|
Nice addition |
hectorvent
approved these changes
Apr 13, 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.
…sage
When ReceiveMessage does not specify a VisibilityTimeout parameter, doReceiveMessage falls back to the global default (30s) instead of the queue's own VisibilityTimeout attribute. This causes messages to stay invisible far longer than expected, which in turn breaks DLQ redrive for queues configured with a short visibility timeout — the message never becomes visible within a reasonable window for the receive-count check to trigger.
Summary
SqsService.doReceiveMessage() uses the global defaultVisibilityTimeout (30s) when the ReceiveMessage request omits VisibilityTimeout, ignoring the queue's own VisibilityTimeout attribute set at creation time. This breaks DLQ redrive for queues with short visibility timeouts since messages stay invisible for 30s instead of the configured value.
The fix reads the queue's VisibilityTimeout attribute as the intermediate fallback: request parameter > queue attribute > global default. This matches https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html#configuring-visibility-timeout.
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
In real AWS SQS, when ReceiveMessage does not include a VisibilityTimeout parameter, the queue's default visibility timeout (set via CreateQueue or SetQueueAttributes) is used — not a global server default. Verified against AWS SDK v2 (software.amazon.awssdk:sqs:2.29.52) with a Spring Cloud AWS SQS listener that does not specify visibility timeout per-request. The incorrect behavior: a queue created with VisibilityTimeout=1 had its messages stay invisible for 30 seconds after receive, preventing timely DLQ redrive.
Checklist
./mvnw testpasses locally