[ 
https://issues.apache.org/jira/browse/CAMEL-21550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Narsi Reddy Nallamilli updated CAMEL-21550:
-------------------------------------------
    Summary: camel-aws-sqs - message is getting expired before extender changes 
the visibility  (was: camel-aws-sqs - message is getting expired before 
extender changes the visibility before first trigger)

> camel-aws-sqs - message is getting expired before extender changes the 
> visibility
> ---------------------------------------------------------------------------------
>
>                 Key: CAMEL-21550
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21550
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws2-sqs
>            Reporter: Narsi Reddy Nallamilli
>            Priority: Major
>             Fix For: 4.10.0
>
>
> Issue: sqs extender scheduler initial start is set to queues visibility 
> timeout.  when the fifo queues in the application are couple of them it works 
> but when its more it causes this issue.
> {code:java}
> if (visibilityTimeout != null && visibilityTimeout > 0) {
>                 int delay = visibilityTimeout;
>                 int repeatSeconds = (int) (visibilityTimeout.doubleValue() * 
> 1.5);
>                 this.timeoutExtender = new TimeoutExtender(repeatSeconds);
>                 if (LOG.isDebugEnabled()) {
>                     LOG.debug(
>                             "Scheduled TimeoutExtender task to start after {} 
> delay, and run with {}/{} period/repeat (seconds)",
>                             delay, delay, repeatSeconds);
>                 }
>                 this.scheduledFuture
>                         = 
> scheduledExecutor.scheduleAtFixedRate(this.timeoutExtender, delay, delay, 
> TimeUnit.SECONDS);
>             }
> {code}
> E.g if the visibility is 10sec the extender would start around 10sec and by 
> the time the extender changes the visibility the message's visibility in the 
> queue would have expired and got removed. And since the extender uses the 
> expired message receipt handle sqs server return 
> ReceiptHandleIsInvalidException but because this exception is supressed sqs 
> client assumes it was successful.
> {code:java}
> try {
>                         LOG.trace("Extending visibility window by {} seconds 
> for request entries {}", repeatSeconds,
>                                 batchEntries);
>                         
> getEndpoint().getClient().changeMessageVisibilityBatch(request);
>                         LOG.debug("Extended visibility window for request 
> entries {}", batchEntries);
>                     } catch (MessageNotInflightException | 
> ReceiptHandleIsInvalidException e) {
>                         // Ignore.
>                     } catch (SqsException e) {
>                         if (e.getMessage()
>                                 .contains("Message does not exist or is not 
> available for visibility timeout change")) {
>                             // Ignore.
>                         } else {
>                             logException(e, batchEntries);
>                         }
>                     } catch (Exception e) {
>                         logException(e, batchEntries);
>                     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to