From 466f7770c79cc9b977043519eb6ca7204ae9c917 Mon Sep 17 00:00:00 2001 From: Marcos Tischer Vallim Date: Wed, 22 Jul 2026 22:37:11 -0300 Subject: [PATCH 1/5] chore: fixing typo Signed-off-by: Marcos Tischer Vallim --- README.md | 2 +- .../lib/core/AbstractAmazonSqsConsumer.java | 23 +++++++++++++------ .../lib/core/AbstractAmazonSqsProducer.java | 8 +++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8226aa4..09bdf69 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ _**Compatible AWS JDK v1 >= 1.12**_ _**Compatible AWS JDK v2 >= 2.18**_ -This library supports **`Kotlin`** aswell +This library supports **`Kotlin`** as well ## 1. Quick Start diff --git a/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsConsumer.java b/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsConsumer.java index 0153825..1ebee09 100644 --- a/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsConsumer.java +++ b/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsConsumer.java @@ -18,8 +18,8 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; +import java.util.ArrayList; import java.util.Collections; -import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -31,7 +31,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.LockSupport; import java.util.function.BiFunction; import java.util.function.UnaryOperator; @@ -63,6 +62,7 @@ * @param the publish batch result type * @param the request entry payload type */ +@SuppressWarnings("java:S135") abstract class AbstractAmazonSqsConsumer implements Runnable, AmazonSqsConsumer { /** @@ -278,7 +278,7 @@ private boolean canAddPayload(final int batchSizeBytes) { @SneakyThrows private Optional createBatch(final BlockingQueue> requests) { final AtomicInteger batchSizeBytes = new AtomicInteger(0); - final List requestEntries = new LinkedList<>(); + final List requestEntries = new ArrayList<>(queueProperty.getMaxBatchSize()); while (canAddToBatch(batchSizeBytes.get(), requestEntries.size(), requests.peek())) { final RequestEntry request = requests.peek(); @@ -299,7 +299,8 @@ private Optional createBatch(final BlockingQueue> requests) { final String stringPayload = new String(payload, StandardCharsets.UTF_8); - final String message = String.format("The maximum allowed message size exceeding 1024KB (1,048,576 bytes). Payload: %s, Headers: %s", stringPayload, request.getMessageHeaders()); + final String message = String.format("The maximum allowed message size exceeding 1024KB (1,048,576 bytes). Payload: %s, Headers: %s", + stringPayload, request.getMessageHeaders()); handleError(publishBatchRequest, new MaximumAllowedMessageException(message, requests.take())); @@ -309,8 +310,11 @@ private Optional createBatch(final BlockingQueue> requests) { continue; } - if (canAddPayload(batchSizeBytes.addAndGet(messageSize))) { + if (canAddPayload(batchSizeBytes.get() + messageSize)) { requestEntries.add(requestEntryInternalFactory.create(requests.take(), payload)); + batchSizeBytes.addAndGet(messageSize); + } else { + break; } } @@ -337,8 +341,13 @@ private Optional createBatch(final BlockingQueue> requests) { @SneakyThrows public CompletableFuture await() { return CompletableFuture.runAsync(() -> { - while (MapUtils.isNotEmpty(this.pendingRequests) || CollectionUtils.isNotEmpty(this.queueRequests)) { - LockSupport.parkNanos(Duration.ofMillis(queueProperty.getLinger()).toNanos()); + while (MapUtils.isNotEmpty(pendingRequests) || CollectionUtils.isNotEmpty(queueRequests)) { + try { + TimeUnit.NANOSECONDS.sleep(Duration.ofMillis(queueProperty.getLinger()).toNanos()); + } catch (final InterruptedException e) { + Thread.currentThread().interrupt(); + LOGGER.warn("await() interrupted"); + } } }); } diff --git a/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsProducer.java b/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsProducer.java index c0ac684..c71657a 100644 --- a/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsProducer.java +++ b/amazon-sqs-java-messaging-lib-template/src/main/java/com/amazon/sqs/messaging/lib/core/AbstractAmazonSqsProducer.java @@ -38,7 +38,7 @@ @RequiredArgsConstructor(access = AccessLevel.PROTECTED) abstract class AbstractAmazonSqsProducer implements AmazonSqsProducer { - private final AtomicReference state = new AtomicReference<>(State.RUNNIG); + private final AtomicReference state = new AtomicReference<>(State.RUNNING); private final ConcurrentMap> pendingRequests; @@ -53,7 +53,7 @@ abstract class AbstractAmazonSqsProducer implements AmazonSqsProducer { @Override @SneakyThrows public ListenableFuture send(final RequestEntry requestEntry) { - if (State.RUNNIG.equals(state.get())) { + if (State.RUNNING.equals(state.get())) { return enqueueRequest(requestEntry); } else { final ListenableFutureImpl listenableFutureImpl = new ListenableFutureImpl(); @@ -75,7 +75,7 @@ public ListenableFuture send(final Requ */ @Override public void shutdown() { - state.compareAndSet(State.RUNNIG, State.SHUTDOWN); + state.compareAndSet(State.RUNNING, State.SHUTDOWN); } /** @@ -96,7 +96,7 @@ private ListenableFuture enqueueRequest * Lifecycle states of the producer. */ enum State { - RUNNIG, SHUTDOWN + RUNNING, SHUTDOWN } } \ No newline at end of file From 412291204028cb19aa4dc9a28bdf865cbd3da055 Mon Sep 17 00:00:00 2001 From: Marcos Tischer Vallim Date: Wed, 22 Jul 2026 22:50:54 -0300 Subject: [PATCH 2/5] ci: update pipeline --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1cdadf..e6ea6a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - feature/** - fix/** + - dependabot/maven/** env: TYPE: ${{ startsWith(github.ref_name, 'feature') && 'Feature' || 'Fix'}} From 288d02b4b9977340edc012520ef37ba3ae1752f2 Mon Sep 17 00:00:00 2001 From: Marcos Tischer Vallim Date: Wed, 22 Jul 2026 23:00:07 -0300 Subject: [PATCH 3/5] ci: update jvm from 17 to 21 --- .github/workflows/ci-gates.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-gates.yml b/.github/workflows/ci-gates.yml index 9b772c4..cfe03c6 100644 --- a/.github/workflows/ci-gates.yml +++ b/.github/workflows/ci-gates.yml @@ -13,10 +13,10 @@ jobs: with: fetch-depth: 0 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v5 with: - java-version: 17 + java-version: 21 distribution: "corretto" cache: "maven" From c782689eff6fd55185ba1561968db00a00e7c0f7 Mon Sep 17 00:00:00 2001 From: Marcos Tischer Vallim Date: Wed, 22 Jul 2026 23:06:52 -0300 Subject: [PATCH 4/5] ci: reduce verbose with env MAVEN_ARGS: "--no-transfer-progress" --- .github/workflows/cd-deploy.yml | 2 ++ .github/workflows/cd-integration.yml | 2 ++ .github/workflows/ci-gates.yml | 2 ++ .github/workflows/ci-maven.yml | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/.github/workflows/cd-deploy.yml b/.github/workflows/cd-deploy.yml index 4c987ab..f123d53 100644 --- a/.github/workflows/cd-deploy.yml +++ b/.github/workflows/cd-deploy.yml @@ -12,6 +12,8 @@ jobs: publish: environment: ${{ inputs.environment }} runs-on: ubuntu-latest + env: + MAVEN_ARGS: "--no-transfer-progress" steps: - name: Checkout repository uses: actions/checkout@v6 diff --git a/.github/workflows/cd-integration.yml b/.github/workflows/cd-integration.yml index 670b6c3..bb91de1 100644 --- a/.github/workflows/cd-integration.yml +++ b/.github/workflows/cd-integration.yml @@ -15,6 +15,8 @@ jobs: variables: if: ${{ github.event.pull_request.merged == true }} runs-on: ubuntu-latest + env: + MAVEN_ARGS: "--no-transfer-progress" outputs: version: ${{ steps.environment.outputs.version }} target-branch: ${{ steps.environment.outputs.target-branch }} diff --git a/.github/workflows/ci-gates.yml b/.github/workflows/ci-gates.yml index cfe03c6..e4860d3 100644 --- a/.github/workflows/ci-gates.yml +++ b/.github/workflows/ci-gates.yml @@ -7,6 +7,8 @@ jobs: sonarcloud: environment: sonarcloud runs-on: ubuntu-latest + env: + MAVEN_ARGS: "--no-transfer-progress" steps: - name: Checkout repository uses: actions/checkout@v6 diff --git a/.github/workflows/ci-maven.yml b/.github/workflows/ci-maven.yml index d1572e6..d466f6c 100644 --- a/.github/workflows/ci-maven.yml +++ b/.github/workflows/ci-maven.yml @@ -6,6 +6,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + MAVEN_ARGS: "--no-transfer-progress" strategy: matrix: java-version: [8, 11, 17, 21, 25] @@ -32,6 +34,8 @@ jobs: test: runs-on: ubuntu-latest + env: + MAVEN_ARGS: "--no-transfer-progress" strategy: matrix: java-version: [8, 11, 17, 21, 25] From c99be10de77136f8e2d03967717b62b04330326b Mon Sep 17 00:00:00 2001 From: Marcos Tischer Vallim Date: Wed, 22 Jul 2026 23:23:32 -0300 Subject: [PATCH 5/5] chore: new release 1.3.2 Signed-off-by: Marcos Tischer Vallim --- amazon-sqs-java-messaging-lib-template/pom.xml | 2 +- amazon-sqs-java-messaging-lib-v1/pom.xml | 2 +- amazon-sqs-java-messaging-lib-v2/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amazon-sqs-java-messaging-lib-template/pom.xml b/amazon-sqs-java-messaging-lib-template/pom.xml index 42df961..be4fe96 100644 --- a/amazon-sqs-java-messaging-lib-template/pom.xml +++ b/amazon-sqs-java-messaging-lib-template/pom.xml @@ -7,7 +7,7 @@ com.github.mvallim amazon-sqs-java-messaging-lib - 1.3.1-SNAPSHOT + 1.3.2-SNAPSHOT ../pom.xml diff --git a/amazon-sqs-java-messaging-lib-v1/pom.xml b/amazon-sqs-java-messaging-lib-v1/pom.xml index c649d6a..ed09618 100644 --- a/amazon-sqs-java-messaging-lib-v1/pom.xml +++ b/amazon-sqs-java-messaging-lib-v1/pom.xml @@ -7,7 +7,7 @@ com.github.mvallim amazon-sqs-java-messaging-lib - 1.3.1-SNAPSHOT + 1.3.2-SNAPSHOT ../pom.xml diff --git a/amazon-sqs-java-messaging-lib-v2/pom.xml b/amazon-sqs-java-messaging-lib-v2/pom.xml index f713ee8..a48db35 100644 --- a/amazon-sqs-java-messaging-lib-v2/pom.xml +++ b/amazon-sqs-java-messaging-lib-v2/pom.xml @@ -7,7 +7,7 @@ com.github.mvallim amazon-sqs-java-messaging-lib - 1.3.1-SNAPSHOT + 1.3.2-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 2c997b6..a87abbb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.mvallim amazon-sqs-java-messaging-lib - 1.3.1-SNAPSHOT + 1.3.2-SNAPSHOT pom ${project.artifactId}