CAMEL-23761: Fix BaseSqs.receiveMessageFromQueue to use visibilityTimeout instead of defaultVisibilityTimeout - #1976
Merged
gnodet merged 1 commit intoSep 14, 2026
Conversation
…eout The receiveMessageFromQueue helper used defaultVisibilityTimeout=0 on the consumer endpoint URI, which maps to SetQueueAttributes(VISIBILITY_TIMEOUT=0). On LocalStack, this call inadvertently resets DELAY_SECONDS to 0, defeating the delayed-queue configuration set during queue creation. Fix: replace defaultVisibilityTimeout=0 with visibilityTimeout=0. - visibilityTimeout: per-request ReceiveMessage timeout — does NOT call SetQueueAttributes, does not affect queue attributes. - defaultVisibilityTimeout: queue-level VISIBILITY_TIMEOUT attribute — calls SetQueueAttributes, can corrupt DELAY_SECONDS on LocalStack. This makes SqsDelayedQueueTest.delayedQueue() correctly observe the 20s delay after the message is sent. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Croway
approved these changes
Sep 14, 2026
apupier
approved these changes
Sep 14, 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.
Summary
Fixes
BaseSqs.receiveMessageFromQueueto usevisibilityTimeout=0instead ofdefaultVisibilityTimeout=0, correcting the root cause ofSqsDelayedQueueTest.delayedQueue()failing.Root Cause
BaseSqs.receiveMessageFromQueuebuilt its consumer endpoint URI withdefaultVisibilityTimeout=0. This parameter maps to the queue-levelVISIBILITY_TIMEOUTattribute in AWS SQS, causing Camel to callSetQueueAttributes({VISIBILITY_TIMEOUT: 0})when the endpoint initializes.On LocalStack,
SetQueueAttributeswithVISIBILITY_TIMEOUT=0inadvertently resetsDELAY_SECONDSto 0 as well, overwriting the 20-second delay set during queue creation. The message therefore becomes available immediately, and theDuration.between(start, now).getSeconds() >= delayassertion fails.The two parameters are distinct:
defaultVisibilityTimeout→SetQueueAttributes(VISIBILITY_TIMEOUT)— queue-level attribute, called during endpoint initialization, can overwrite other queue attributes on LocalStackvisibilityTimeout→ReceiveMessage(VisibilityTimeout)— per-request timeout, does not callSetQueueAttributes, does not affectDELAY_SECONDSFix
Replace
defaultVisibilityTimeout=0withvisibilityTimeout=0inBaseSqs.receiveMessageFromQueue. The per-request timeout achieves the same intent (messages re-become visible immediately for the next poll) without modifying the queue'sDELAY_SECONDSattribute.Notes
SqsDelayedQueueTestis still annotated@DisabledIfSystemProperty(named = "ci.env.name", matches = "github.com")since Docker is not available in the GitHub Actions environment. That annotation is unchanged — this PR fixes only the correctness of the test helper.apache/camel(adding the test there with the correct parameter from the start): CAMEL-23761: Add SqsProducerDelayedQueueIT for the delayed queue pattern camel#26395References
Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet