gnodet opened a new pull request, #26395:
URL: https://github.com/apache/camel/pull/26395

   ## Summary
   
   Adds `SqsProducerDelayedQueueIT` — an integration test for the SQS delayed 
queue pattern — and fixes the `visibilityTimeout` usage that caused the test to 
fail.
   
   ## Root Cause
   
   The test from the reporter's branch (`apupier/camel:23761-sqsDelayedQueue`) 
used `defaultVisibilityTimeout=0` on the receive endpoint URL. This parameter 
maps to the queue-level `VISIBILITY_TIMEOUT` attribute and causes Camel to call 
`SetQueueAttributes({VISIBILITY_TIMEOUT: 0})` when the endpoint initializes.
   
   On Localstack, `SetQueueAttributes` with `VISIBILITY_TIMEOUT=0` 
inadvertently resets `DELAY_SECONDS` to 0, destroying the 20-second delay that 
was set when the queue was created. This explains the failure: `actual: 2L >= 
20L`.
   
   The two parameters are distinct:
   - `defaultVisibilityTimeout` → `SetQueueAttributes(VISIBILITY_TIMEOUT)` — 
modifies the queue's attribute permanently
   - `visibilityTimeout` → `ReceiveMessage(VisibilityTimeout)` — per-request 
timeout, does not call `SetQueueAttributes`
   
   ## Fix
   
   In `receiveMessageFromQueue`, replace `defaultVisibilityTimeout=0` with 
`visibilityTimeout=0`. The per-request visibility timeout of 0 seconds achieves 
the same effect (message becomes immediately re-visible after reading, allowing 
the Awaitility poll loop to re-attempt) without modifying the queue's 
`DELAY_SECONDS` attribute via `SetQueueAttributes`.
   
   ## Test
   
   `SqsProducerDelayedQueueIT.delayedQueue()`:
   1. Creates a queue with `DELAY_SECONDS=20` via 
`autoCreateQueue=true&delayQueue=true&delaySeconds=20`
   2. Sends a message to the queue
   3. Polls every 1s (up to 120s) until the message is received
   4. Asserts that ≥20 seconds elapsed before the message was available
   
   Localstack-backed test; requires the `localstack-sqs` service.
   
   ## References
   
   - JIRA: https://issues.apache.org/jira/browse/CAMEL-23761
   - Reporter's branch: `apupier/camel:23761-sqsDelayedQueue`
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to