You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2024/12/16 09:48:00 UTC

[jira] [Updated] (CAMEL-21550) sqs message is getting expired before extended changes the visibility

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

Claus Ibsen updated CAMEL-21550:
--------------------------------
    Fix Version/s: 4.10.0

> sqs message is getting expired before extended 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, 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)