diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index f8ddfca0..567baa4a 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -8,7 +8,7 @@ on: jobs: build-and-publish: name: Java Gradle - uses: bakdata/ci-templates/.github/workflows/java-gradle-library.yaml@1.56.0 + uses: bakdata/ci-templates/.github/workflows/java-gradle-library.yaml@1.62.0 with: java-version: 17 secrets: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8d420bb3..fd3d65d3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ on: jobs: java-gradle-release: name: Java Gradle - uses: bakdata/ci-templates/.github/workflows/java-gradle-release.yaml@1.56.0 + uses: bakdata/ci-templates/.github/workflows/java-gradle-release.yaml@1.62.0 with: java-version: 17 release-type: "${{ inputs.release-type }}" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0fd0202..d9fbee2e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..f3b75f3b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/streams-bootstrap-core/build.gradle.kts b/streams-bootstrap-core/build.gradle.kts index c5018061..ccc714d0 100644 --- a/streams-bootstrap-core/build.gradle.kts +++ b/streams-bootstrap-core/build.gradle.kts @@ -19,6 +19,7 @@ dependencies { version = "2.0.16" ) implementation(group = "org.jooq", name = "jool", version = "0.9.15") + implementation(group = "io.github.resilience4j", name = "resilience4j-retry", version = "1.7.1") val junitVersion: String by project testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = junitVersion) diff --git a/streams-bootstrap-core/src/main/java/com/bakdata/kafka/util/TopicClient.java b/streams-bootstrap-core/src/main/java/com/bakdata/kafka/util/TopicClient.java index 82c5ba58..7118b074 100644 --- a/streams-bootstrap-core/src/main/java/com/bakdata/kafka/util/TopicClient.java +++ b/streams-bootstrap-core/src/main/java/com/bakdata/kafka/util/TopicClient.java @@ -26,6 +26,8 @@ import static java.util.Collections.emptyMap; +import io.github.resilience4j.retry.Retry; +import io.github.resilience4j.retry.RetryConfig; import java.time.Duration; import java.util.Collection; import java.util.List; @@ -55,6 +57,12 @@ @Slf4j public final class TopicClient implements AutoCloseable { + private static final RetryConfig RETRY_CONFIG = RetryConfig.custom() + .retryOnResult(result -> result) + .failAfterMaxAttempts(false) + .maxAttempts(3) + .waitDuration(Duration.ofSeconds(5L)) + .build(); private final @NonNull Admin adminClient; private final @NonNull Duration timeout; @@ -142,7 +150,9 @@ public void deleteTopic(final String topicName) { } catch (final TimeoutException ex) { throw failedToDeleteTopic(topicName, ex); } - if (this.exists(topicName)) { + final Retry retry = Retry.of("topic-deleted", RETRY_CONFIG); + final boolean exists = Retry.decorateSupplier(retry, () -> this.exists(topicName)).get(); + if (exists) { throw new IllegalStateException(String.format("Deletion of topic %s failed", topicName)); } } @@ -259,7 +269,9 @@ public void createTopic(final String topicName, final TopicSettings settings, fi } catch (final TimeoutException ex) { throw failedToCreateTopic(topicName, ex); } - if (!this.exists(topicName)) { + final Retry retry = Retry.of("topic-exists", RETRY_CONFIG); + final boolean doesNotExist = Retry.decorateSupplier(retry, () -> !this.exists(topicName)).get(); + if (doesNotExist) { throw new IllegalStateException(String.format("Creation of topic %s failed", topicName)); } }