jono-morris commented on code in PR #11102: URL: https://github.com/apache/camel/pull/11102#discussion_r1294571928
########## components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java: ########## @@ -404,32 +410,44 @@ public void cancel() { @Override public void run() { if (run.get()) { - ChangeMessageVisibilityRequest.Builder request - = ChangeMessageVisibilityRequest.builder().queueUrl(getQueueUrl()).visibilityTimeout(repeatSeconds) - .receiptHandle(exchange.getIn().getHeader(Sqs2Constants.RECEIPT_HANDLE, String.class)); - - try { - LOG.trace("Extending visibility window by {} seconds for exchange {}", this.repeatSeconds, this.exchange); - getEndpoint().getClient().changeMessageVisibility(request.build()); - LOG.debug("Extended visibility window by {} seconds for exchange {}", this.repeatSeconds, this.exchange); - } catch (MessageNotInflightException | ReceiptHandleIsInvalidException e) { - // Ignore. - } catch (SqsException e) { - if (e.getMessage().contains("Message does not exist or is not available for visibility timeout change")) { + + List<ChangeMessageVisibilityBatchRequestEntry> entries = new LinkedList<>(); + + while (!requestQueue.isEmpty()) { + + // up to 10 requests can be sent with each ChangeMessageVisibilityBatch action + while (!requestQueue.isEmpty() && entries.size() < MAX_REQUESTS) { + entries.add(requestQueue.poll()); Review Comment: Thank you that makes sense, I really appreciate the comments. I'll make amendments tomorrow. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org