This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 62aab3f61ad CAMEL-23761: Fix BaseSqs.receiveMessageFromQueue to use
visibilityTimeout instead of defaultVisibilityTimeout (#1976)
62aab3f61ad is described below
commit 62aab3f61adcd8cbe01616d8412c10c70d70f458
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Sep 14 16:32:47 2026 +0200
CAMEL-23761: Fix BaseSqs.receiveMessageFromQueue to use visibilityTimeout
instead of defaultVisibilityTimeout (#1976)
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 <[email protected]>
---
.../java/org/apache/camel/component/aws2/sqs/BaseSqs.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/components-starter/camel-aws2-sqs-starter/src/test/java/org/apache/camel/component/aws2/sqs/BaseSqs.java
b/components-starter/camel-aws2-sqs-starter/src/test/java/org/apache/camel/component/aws2/sqs/BaseSqs.java
index e7a237658dc..7e1dacce1c5 100644
---
a/components-starter/camel-aws2-sqs-starter/src/test/java/org/apache/camel/component/aws2/sqs/BaseSqs.java
+++
b/components-starter/camel-aws2-sqs-starter/src/test/java/org/apache/camel/component/aws2/sqs/BaseSqs.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.aws2.sqs;
+import java.util.UUID;
import org.apache.camel.CamelContext;
import org.apache.camel.ConsumerTemplate;
import org.apache.camel.ProducerTemplate;
@@ -32,8 +33,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import software.amazon.awssdk.services.sqs.SqsClient;
-import java.util.UUID;
-
public class BaseSqs {
@Autowired
@@ -66,10 +65,13 @@ public class BaseSqs {
}
String receiveMessageFromQueue(String queueName, boolean deleteMessage) {
- return consumerTemplate.receiveBody(
-
String.format("aws2-sqs://%s?deleteAfterRead=%s&deleteIfFiltered=%s&defaultVisibilityTimeout=0",
- queueName, deleteMessage, deleteMessage),
- 10000, String.class);
+ // Use visibilityTimeout (per-request ReceiveMessage timeout) rather
than
+ // defaultVisibilityTimeout (queue-level SetQueueAttributes). The
latter calls
+ // SetQueueAttributes({VISIBILITY_TIMEOUT:0}) which on LocalStack
inadvertently
+ // resets DELAY_SECONDS to 0, breaking delayed-queue tests.
+ return consumerTemplate
+
.receiveBody(String.format("aws2-sqs://%s?deleteAfterRead=%s&deleteIfFiltered=%s&visibilityTimeout=0",
+ queueName, deleteMessage, deleteMessage), 10000,
String.class);
}
// *************************************