davsclaus commented on code in PR #28201:
URL: https://github.com/apache/camel/pull/28201#discussion_r4333295206


##########
components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java:
##########
@@ -107,13 +108,16 @@ protected int poll() throws Exception {
         shutdownRunningTask = null;
         pendingExchanges = 0;
 
+        // the visibility timeout of a message starts at its receive, and a 
poll with several (long polling) receive
+        // requests returns only when the last of them is done, so the 
messages are dated from the start of the poll
+        final Instant pollStarted = Instant.now();

Review Comment:
   Optional: the poll start is a safe lower bound. But with long polling it can 
be up to `waitTimeSeconds` before the receive, even with a single receive 
request (`maxMessagesPerPoll` <= 10). Take a message that arrives late in a 20 
s long poll with `visibilityTimeout=30`: it is due at once, so it gets a 
`ChangeMessageVisibilityBatch` call right after the receive, even when the 
route finishes in milliseconds (unless the exchange completes before the 
extender thread picks it up). An alternative is to take the time when the first 
receive request that returned messages completed (in `PollingTask`). That is 
close to the real receive and late only by the response latency, which the 20% 
margin covers. Fine to leave as is, since the description already mentions the 
extra call.



-- 
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