Skip to content

fix(sqs): use queue-level VisibilityTimeout as fallback in ReceiveMes…#413

Merged
hectorvent merged 1 commit intofloci-io:mainfrom
klosowskiMikolaj:fix/sqs-queue-visibility-timeout-fallback
Apr 13, 2026
Merged

fix(sqs): use queue-level VisibilityTimeout as fallback in ReceiveMes…#413
hectorvent merged 1 commit intofloci-io:mainfrom
klosowskiMikolaj:fix/sqs-queue-visibility-timeout-fallback

Conversation

@klosowskiMikolaj
Copy link
Copy Markdown
Contributor

…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

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

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 test passes locally
  • New or updated integration test added
  • Commit messages follow Conventional Commits

…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.
@hectorvent
Copy link
Copy Markdown
Collaborator

Hi @klosowskiMikolaj

Nice addition

@hectorvent hectorvent merged commit db21bc9 into floci-io:main Apr 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants