This is an automated email from the ASF dual-hosted git repository.
wmedvedeo pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git
The following commit(s) were added to refs/heads/main by this push:
new f0b09e3d82 [NO-ISSUE] restore Kogito data-index and job-service
availability health checks (#4073)
f0b09e3d82 is described below
commit f0b09e3d82939d1d251e9d136b7e20c9e7947c92
Author: Walter Medvedeo <[email protected]>
AuthorDate: Mon Sep 29 18:21:33 2025 +0200
[NO-ISSUE] restore Kogito data-index and job-service availability health
checks (#4073)
- restores data-index and jobs service availabitly checks that 1) works
fine, 2) are diabled by default and only used in the knative-eventing addon,
and 3) where removed by notifying nobody
---
kogito-bom/pom.xml | 40 ++++++++
.../kogito-addons-quarkus-common-health/.gitignore | 57 +++++++++++
.../kogito-addons-quarkus-common-health/pom.xml | 78 ++++++++++++++
.../common/config/AbstractAliasConfigSource.java | 56 ++++++++++
.../config/AbstractAliasConfigSourceFactory.java | 50 +++++++++
.../health/AbstractAvailabilityHealthCheck.java | 113 +++++++++++++++++++++
.../AbstractAvailabilityHealthCheckTest.java | 99 ++++++++++++++++++
.../.gitignore | 57 +++++++++++
.../pom.xml | 83 +++++++++++++++
.../health/DataIndexAvailabilityHealthCheck.java | 47 +++++++++
...taIndexAvailabilityHealthCheckConfigSource.java | 43 ++++++++
...AvailabilityHealthCheckConfigSourceFactory.java | 29 ++++++
.../src/main/resources/META-INF/beans.xml} | 22 ----
.../io.smallrye.config.ConfigSourceFactory | 20 ++++
...ataIndexServiceAvailabilityHealthCheckTest.java | 40 ++++++++
.../.gitignore | 57 +++++++++++
.../pom.xml | 83 +++++++++++++++
.../health/JobsServiceAvailabilityHealthCheck.java | 47 +++++++++
...ServiceAvailabilityHealthCheckConfigSource.java | 43 ++++++++
...AvailabilityHealthCheckConfigSourceFactory.java | 29 ++++++
.../src/main/resources/META-INF/beans.xml} | 22 ----
.../io.smallrye.config.ConfigSourceFactory | 20 ++++
.../JobsServiceAvailabilityHealthCheckTest.java | 40 ++++++++
quarkus/addons/common/pom.xml | 3 +
.../addons/jobs/knative-eventing/runtime/pom.xml | 4 +
quarkus/addons/knative/eventing/runtime/pom.xml | 10 ++
26 files changed, 1148 insertions(+), 44 deletions(-)
diff --git a/kogito-bom/pom.xml b/kogito-bom/pom.xml
index 314c77cefc..eceb1cb70c 100755
--- a/kogito-bom/pom.xml
+++ b/kogito-bom/pom.xml
@@ -1672,6 +1672,46 @@
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-jobs-service-health</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-jobs-service-health</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-data-index-health</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-data-index-health</artifactId>
+ <version>${project.version}</version>
+ <classifier>sources</classifier>
+ </dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kogito-addons-springboot-jobs-management</artifactId>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-common-health/.gitignore
b/quarkus/addons/common/kogito-addons-quarkus-common-health/.gitignore
new file mode 100644
index 0000000000..eef7c80055
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-common-health/.gitignore
@@ -0,0 +1,57 @@
+###
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###
+
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/quarkus/addons/common/kogito-addons-quarkus-common-health/pom.xml
b/quarkus/addons/common/kogito-addons-quarkus-common-health/pom.xml
new file mode 100644
index 0000000000..8e5520fb71
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-common-health/pom.xml
@@ -0,0 +1,78 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <name>kogito-addons-quarkus-common-health</name>
+ <properties>
+
<java.module.name>org.kie.kogito.addons.quarkus.common.health</java.module.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.microprofile.health</groupId>
+ <artifactId>microprofile-health-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.smallrye.config</groupId>
+ <artifactId>smallrye-config-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.smallrye.reactive</groupId>
+ <artifactId>smallrye-mutiny-vertx-web-client</artifactId>
+ </dependency>
+ <!-- Testing dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSource.java
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSource.java
new file mode 100644
index 0000000000..467519cba4
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSource.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.common.config;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public abstract class AbstractAliasConfigSource implements ConfigSource {
+
+ protected int ordinal;
+ protected String configValue;
+ protected final Set<String> propertyNames = new HashSet<>();
+
+ public AbstractAliasConfigSource(Set<String> propertyNames) {
+ this.propertyNames.addAll(propertyNames);
+ }
+
+ public void setOrdinal(int ordinal) {
+ this.ordinal = ordinal;
+ }
+
+ public void setConfigValue(String configValue) {
+ this.configValue = configValue;
+ }
+
+ public abstract String getConfigAlias();
+
+ @Override
+ public Set<String> getPropertyNames() {
+ return propertyNames;
+ }
+
+ @Override
+ public String getValue(String propertyName) {
+ return propertyNames.contains(propertyName) ? configValue : null;
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSourceFactory.java
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSourceFactory.java
new file mode 100644
index 0000000000..7104c659af
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/config/AbstractAliasConfigSourceFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.common.config;
+
+import java.util.List;
+
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+import io.smallrye.config.ConfigSourceContext;
+import io.smallrye.config.ConfigSourceFactory;
+import io.smallrye.config.ConfigValue;
+
+public class AbstractAliasConfigSourceFactory<T extends
AbstractAliasConfigSource> implements ConfigSourceFactory {
+
+ protected T configSource;
+
+ public AbstractAliasConfigSourceFactory(T configSource) {
+ this.configSource = configSource;
+ }
+
+ @Override
+ public Iterable<ConfigSource> getConfigSources(ConfigSourceContext
context) {
+ ConfigValue configValue =
context.getValue(configSource.getConfigAlias());
+ String value = configValue.getValue();
+ if (value == null || value.isEmpty()) {
+ return List.of();
+ } else {
+ configSource.setConfigValue(value);
+ configSource.setOrdinal(configValue.getSourceOrdinal());
+ return List.of(configSource);
+ }
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheck.java
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheck.java
new file mode 100644
index 0000000000..ca86f96e3b
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/main/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheck.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.common.health;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.time.Duration;
+
+import org.eclipse.microprofile.health.HealthCheck;
+import org.eclipse.microprofile.health.HealthCheckResponse;
+import org.eclipse.microprofile.health.HealthCheckResponseBuilder;
+
+import io.vertx.core.http.HttpMethod;
+import io.vertx.core.json.JsonObject;
+import io.vertx.mutiny.core.Vertx;
+import io.vertx.mutiny.core.buffer.Buffer;
+import io.vertx.mutiny.ext.web.client.HttpResponse;
+import io.vertx.mutiny.ext.web.client.WebClient;
+
+public abstract class AbstractAvailabilityHealthCheck implements HealthCheck {
+
+ private static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(500);
+ private static final int DEFAULT_PORT = 80;
+
+ protected String serviceName;
+
+ protected String serviceUrl;
+
+ protected String healthPath;
+
+ protected String checkType;
+
+ protected Vertx vertx;
+
+ protected WebClient webClient;
+
+ protected Duration requestTimeout;
+
+ public AbstractAvailabilityHealthCheck() {
+ // CDI
+ }
+
+ public AbstractAvailabilityHealthCheck(String serviceName, String
serviceUrl, String healthPath, String checkType,
+ Vertx vertx, Duration requestTimeout) {
+ this.serviceName = serviceName;
+ this.serviceUrl = serviceUrl;
+ this.healthPath = healthPath;
+ this.checkType = checkType;
+ this.vertx = vertx;
+ this.requestTimeout = requestTimeout != null ? requestTimeout :
DEFAULT_TIMEOUT;
+ this.webClient = createClient();
+ }
+
+ /**
+ * facilitates tests.
+ */
+ protected WebClient createClient() {
+ return WebClient.create(vertx);
+ }
+
+ @Override
+ public HealthCheckResponse call() {
+ HealthCheckResponseBuilder builder =
HealthCheckResponse.named(serviceName + " Availability - " + checkType).up();
+ if (serviceUrl == null) {
+ builder.down().withData("error", serviceName + " url is not
configured");
+ } else {
+ URL url;
+ try {
+ url = new URL(serviceUrl);
+ HttpResponse<Buffer> response =
webClient.request(HttpMethod.GET,
+ url.getPort() > 0 ? url.getPort() : DEFAULT_PORT,
+ url.getHost(),
+ healthPath)
+ .send()
+ .await()
+ .atMost(requestTimeout);
+ if (response.statusCode() != 200) {
+ String data = "[" + response.statusCode() + "] - " +
response.statusMessage();
+ builder.down().withData("error", data);
+ } else {
+ JsonObject jsonResponse = response.bodyAsJsonObject();
+ if (jsonResponse == null ||
!HealthCheckResponse.Status.UP.name().equals(jsonResponse.getString("status")))
{
+ builder.down();
+ }
+ }
+ } catch (Exception e) {
+ if (e instanceof MalformedURLException) {
+ builder.down().withData("error", serviceName + " url
configuration error: " + e.getMessage());
+ } else {
+ builder.down().withData("error", "[unknown] - " +
e.getMessage());
+ }
+ }
+ }
+ return builder.build();
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-common-health/src/test/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheckTest.java
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/test/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheckTest.java
new file mode 100644
index 0000000000..86d3b98b27
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-common-health/src/test/java/org/kie/kogito/addon/quarkus/common/health/AbstractAvailabilityHealthCheckTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.common.health;
+
+import org.eclipse.microprofile.health.HealthCheckResponse;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import io.smallrye.mutiny.Uni;
+import io.vertx.core.http.HttpMethod;
+import io.vertx.core.json.JsonObject;
+import io.vertx.mutiny.core.Vertx;
+import io.vertx.mutiny.core.buffer.Buffer;
+import io.vertx.mutiny.ext.web.client.HttpRequest;
+import io.vertx.mutiny.ext.web.client.HttpResponse;
+import io.vertx.mutiny.ext.web.client.WebClient;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+
+@ExtendWith(MockitoExtension.class)
+public abstract class AbstractAvailabilityHealthCheckTest {
+
+ protected static final String HOST = "service-host";
+ protected static final int PORT = 8080;
+ protected static final String SERVICE_URL = "http://" + HOST + ":" + PORT;
+ protected static final String HEALTH_PATH = "/q/health/ready";
+ protected AbstractAvailabilityHealthCheck healthCheck;
+ @Mock
+ protected Vertx vertx;
+ @Mock
+ protected WebClient webClient;
+
+ protected abstract AbstractAvailabilityHealthCheck
createHealthCheck(String serviceUrl, Vertx vertxMock, WebClient webClientMock);
+
+ @Test
+ void healthCheckUp() {
+ healthCheck = createHealthCheck(SERVICE_URL, vertx, webClient);
+ prepareCall(HOST, PORT, HEALTH_PATH, HealthCheckResponse.Status.UP,
false);
+ HealthCheckResponse response = healthCheck.call();
+
assertThat(response.getStatus()).isEqualTo(HealthCheckResponse.Status.UP);
+ }
+
+ @Test
+ void healthCheckDown() {
+ healthCheck = createHealthCheck(SERVICE_URL, vertx, webClient);
+ prepareCall(HOST, PORT, HEALTH_PATH, HealthCheckResponse.Status.DOWN,
false);
+ HealthCheckResponse response = healthCheck.call();
+
assertThat(response.getStatus()).isEqualTo(HealthCheckResponse.Status.DOWN);
+ }
+
+ @Test
+ void healthCheckDownServiceCallError() {
+ healthCheck = createHealthCheck(SERVICE_URL, vertx, webClient);
+ prepareCall(HOST, PORT, HEALTH_PATH, HealthCheckResponse.Status.UP,
true);
+ HealthCheckResponse response = healthCheck.call();
+
assertThat(response.getStatus()).isEqualTo(HealthCheckResponse.Status.DOWN);
+ assertThat(response.getData()).isPresent();
+ Object error = response.getData().get().get("error");
+ assertThat(error).isNotNull().hasToString("[500] - Internal server
error");
+ }
+
+ protected void prepareCall(String host, int port, String path,
HealthCheckResponse.Status responseStatus, boolean mockError) {
+ HttpRequest<Buffer> requestMock = mock(HttpRequest.class);
+ doReturn(requestMock).when(webClient).request(HttpMethod.GET, port,
host, path);
+
+ HttpResponse<Buffer> httpResponse = mock(HttpResponse.class);
+ JsonObject jsonObject = JsonObject.of("status", responseStatus.name());
+ lenient().doReturn(jsonObject).when(httpResponse).bodyAsJsonObject();
+ int statusCode = 200;
+ if (mockError) {
+ statusCode = 500;
+ doReturn("Internal server
error").when(httpResponse).statusMessage();
+ }
+ doReturn(statusCode).when(httpResponse).statusCode();
+ doReturn(Uni.createFrom().item(httpResponse)).when(requestMock).send();
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/.gitignore
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/.gitignore
new file mode 100644
index 0000000000..eef7c80055
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/.gitignore
@@ -0,0 +1,57 @@
+###
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###
+
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/pom.xml
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/pom.xml
new file mode 100644
index 0000000000..88ad4996b5
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/pom.xml
@@ -0,0 +1,83 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <artifactId>kogito-addons-quarkus-data-index-health</artifactId>
+ <name>kogito-addons-quarkus-data-index-health</name>
+ <properties>
+
<java.module.name>org.kie.kogito.addons.quarkus.index.health</java.module.name>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.microprofile.health</groupId>
+ <artifactId>microprofile-health-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.smallrye.reactive</groupId>
+ <artifactId>smallrye-mutiny-vertx-web-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ </dependency>
+ <!-- Testing dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-smallrye-health</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheck.java
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheck.java
new file mode 100644
index 0000000000..1179f01d4c
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheck.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.index.health;
+
+import java.time.Duration;
+import java.util.Optional;
+
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.eclipse.microprofile.health.Startup;
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheck;
+
+import io.vertx.mutiny.core.Vertx;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@Startup
+@ApplicationScoped
+public class DataIndexAvailabilityHealthCheck extends
AbstractAvailabilityHealthCheck {
+
+ private static final String KOGITO_DATA_INDEX_URL =
"kogito.data-index.url";
+
+ public static final String CONFIG_ALIAS =
"kogito.data-index.health-enabled";
+
+ @Inject
+ public DataIndexAvailabilityHealthCheck(@ConfigProperty(name =
KOGITO_DATA_INDEX_URL) Optional<String> dataIndexUrl,
+ Vertx vertx) {
+ super("Data Index", dataIndexUrl.orElse(null), "/q/health/ready",
"startup check", vertx, Duration.ofMillis(500));
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSource.java
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSource.java
new file mode 100644
index 0000000000..f9f6394cb6
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSource.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.index.health;
+
+import java.util.Set;
+
+import org.kie.kogito.addon.quarkus.common.config.AbstractAliasConfigSource;
+
+public class DataIndexAvailabilityHealthCheckConfigSource extends
AbstractAliasConfigSource {
+
+ public DataIndexAvailabilityHealthCheckConfigSource() {
+ super(Set.of(
+ "io.smallrye.health.check." +
DataIndexAvailabilityHealthCheck.class.getName() + ".enabled",
+ DataIndexAvailabilityHealthCheck.CONFIG_ALIAS));
+ }
+
+ @Override
+ public String getConfigAlias() {
+ return DataIndexAvailabilityHealthCheck.CONFIG_ALIAS;
+ }
+
+ @Override
+ public String getName() {
+ return
DataIndexAvailabilityHealthCheckConfigSource.class.getSimpleName();
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSourceFactory.java
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSourceFactory.java
new file mode 100644
index 0000000000..d3f451c3e0
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/java/org/kie/kogito/addon/quarkus/index/health/DataIndexAvailabilityHealthCheckConfigSourceFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.index.health;
+
+import
org.kie.kogito.addon.quarkus.common.config.AbstractAliasConfigSourceFactory;
+
+public class DataIndexAvailabilityHealthCheckConfigSourceFactory extends
AbstractAliasConfigSourceFactory<DataIndexAvailabilityHealthCheckConfigSource> {
+
+ public DataIndexAvailabilityHealthCheckConfigSourceFactory() {
+ super(new DataIndexAvailabilityHealthCheckConfigSource());
+ }
+}
\ No newline at end of file
diff --git a/quarkus/addons/common/pom.xml
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/beans.xml
similarity index 50%
copy from quarkus/addons/common/pom.xml
copy to
quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/beans.xml
index 24200ed798..a0eb9fbf8c 100644
--- a/quarkus/addons/common/pom.xml
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/beans.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -19,24 +18,3 @@
under the License.
-->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>kogito-addons-quarkus-parent</artifactId>
- <groupId>org.kie</groupId>
- <version>999-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>kogito-addons-quarkus-common-parent</artifactId>
- <name>Kogito Add-On Quarkus Common - Parent</name>
- <packaging>pom</packaging>
- <description>Collection of common libraries used by Kogito Quarkus
Add-ons.</description>
-
- <modules>
- <module>deployment</module>
- <module>reactive-messaging</module>
- </modules>
-
-</project>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
new file mode 100644
index 0000000000..515aa0d508
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+org.kie.kogito.addon.quarkus.index.health.DataIndexAvailabilityHealthCheckConfigSourceFactory
\ No newline at end of file
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/test/java/org/kie/kogito/addon/quarkus/index/health/DataIndexServiceAvailabilityHealthCheckTest.java
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/test/java/org/kie/kogito/addon/quarkus/index/health/DataIndexServiceAvailabilityHealthCheckTest.java
new file mode 100644
index 0000000000..ebba81ebf5
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-data-index-health/src/test/java/org/kie/kogito/addon/quarkus/index/health/DataIndexServiceAvailabilityHealthCheckTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.index.health;
+
+import java.util.Optional;
+
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheck;
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheckTest;
+
+import io.vertx.mutiny.core.Vertx;
+import io.vertx.mutiny.ext.web.client.WebClient;
+
+class DataIndexServiceAvailabilityHealthCheckTest extends
AbstractAvailabilityHealthCheckTest {
+ @Override
+ protected AbstractAvailabilityHealthCheck createHealthCheck(String
serviceUrl, Vertx vertxMock, WebClient webClientMock) {
+ return new DataIndexAvailabilityHealthCheck(Optional.of(serviceUrl),
vertxMock) {
+ @Override
+ public WebClient createClient() {
+ return webClientMock;
+ }
+ };
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/.gitignore
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/.gitignore
new file mode 100644
index 0000000000..eef7c80055
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/.gitignore
@@ -0,0 +1,57 @@
+###
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###
+
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/pom.xml
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/pom.xml
new file mode 100644
index 0000000000..d628ee5fe2
--- /dev/null
+++ b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/pom.xml
@@ -0,0 +1,83 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-parent</artifactId>
+ <version>999-SNAPSHOT</version>
+ </parent>
+ <artifactId>kogito-addons-quarkus-jobs-service-health</artifactId>
+ <name>kogito-addons-quarkus-jobs-service-health</name>
+ <properties>
+
<java.module.name>org.kie.kogito.addons.quarkus.jobs.health</java.module.name>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.microprofile.health</groupId>
+ <artifactId>microprofile-health-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.smallrye.reactive</groupId>
+ <artifactId>smallrye-mutiny-vertx-web-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ </dependency>
+ <!-- Testing dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-smallrye-health</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-common-health</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheck.java
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheck.java
new file mode 100644
index 0000000000..eb210811ed
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheck.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.jobs.health;
+
+import java.time.Duration;
+import java.util.Optional;
+
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.eclipse.microprofile.health.Startup;
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheck;
+
+import io.vertx.mutiny.core.Vertx;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@Startup
+@ApplicationScoped
+public class JobsServiceAvailabilityHealthCheck extends
AbstractAvailabilityHealthCheck {
+
+ private static final String KOGITO_JOBS_SERVICE_URL =
"kogito.jobs-service.url";
+
+ public static final String CONFIG_ALIAS =
"kogito.jobs-service.health-enabled";
+
+ @Inject
+ public JobsServiceAvailabilityHealthCheck(@ConfigProperty(name =
KOGITO_JOBS_SERVICE_URL) Optional<String> jobsServiceUrl,
+ Vertx vertx) {
+ super("Jobs Service", jobsServiceUrl.orElse(null), "/q/health/ready",
"startup check", vertx, Duration.ofMillis(500));
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSource.java
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSource.java
new file mode 100644
index 0000000000..d75e68a58d
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSource.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.jobs.health;
+
+import java.util.Set;
+
+import org.kie.kogito.addon.quarkus.common.config.AbstractAliasConfigSource;
+
+public class JobsServiceAvailabilityHealthCheckConfigSource extends
AbstractAliasConfigSource {
+
+ public JobsServiceAvailabilityHealthCheckConfigSource() {
+ super(Set.of(
+ "io.smallrye.health.check." +
JobsServiceAvailabilityHealthCheck.class.getName() + ".enabled",
+ JobsServiceAvailabilityHealthCheck.CONFIG_ALIAS));
+ }
+
+ @Override
+ public String getConfigAlias() {
+ return JobsServiceAvailabilityHealthCheck.CONFIG_ALIAS;
+ }
+
+ @Override
+ public String getName() {
+ return
JobsServiceAvailabilityHealthCheckConfigSource.class.getSimpleName();
+ }
+}
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSourceFactory.java
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSourceFactory.java
new file mode 100644
index 0000000000..daebd5ea55
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckConfigSourceFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.jobs.health;
+
+import
org.kie.kogito.addon.quarkus.common.config.AbstractAliasConfigSourceFactory;
+
+public class JobsServiceAvailabilityHealthCheckConfigSourceFactory extends
AbstractAliasConfigSourceFactory<JobsServiceAvailabilityHealthCheckConfigSource>
{
+
+ public JobsServiceAvailabilityHealthCheckConfigSourceFactory() {
+ super(new JobsServiceAvailabilityHealthCheckConfigSource());
+ }
+}
diff --git a/quarkus/addons/common/pom.xml
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/beans.xml
similarity index 50%
copy from quarkus/addons/common/pom.xml
copy to
quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/beans.xml
index 24200ed798..a0eb9fbf8c 100644
--- a/quarkus/addons/common/pom.xml
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/beans.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -19,24 +18,3 @@
under the License.
-->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>kogito-addons-quarkus-parent</artifactId>
- <groupId>org.kie</groupId>
- <version>999-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>kogito-addons-quarkus-common-parent</artifactId>
- <name>Kogito Add-On Quarkus Common - Parent</name>
- <packaging>pom</packaging>
- <description>Collection of common libraries used by Kogito Quarkus
Add-ons.</description>
-
- <modules>
- <module>deployment</module>
- <module>reactive-messaging</module>
- </modules>
-
-</project>
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
new file mode 100644
index 0000000000..9a25fda4f9
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+org.kie.kogito.addon.quarkus.jobs.health.JobsServiceAvailabilityHealthCheckConfigSourceFactory
diff --git
a/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/test/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckTest.java
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/test/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckTest.java
new file mode 100644
index 0000000000..7ac3d8cf75
--- /dev/null
+++
b/quarkus/addons/common/kogito-addons-quarkus-jobs-service-health/src/test/java/org/kie/kogito/addon/quarkus/jobs/health/JobsServiceAvailabilityHealthCheckTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.kie.kogito.addon.quarkus.jobs.health;
+
+import java.util.Optional;
+
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheck;
+import
org.kie.kogito.addon.quarkus.common.health.AbstractAvailabilityHealthCheckTest;
+
+import io.vertx.mutiny.core.Vertx;
+import io.vertx.mutiny.ext.web.client.WebClient;
+
+class JobsServiceAvailabilityHealthCheckTest extends
AbstractAvailabilityHealthCheckTest {
+ @Override
+ protected AbstractAvailabilityHealthCheck createHealthCheck(String
serviceUrl, Vertx vertxMock, WebClient webClientMock) {
+ return new JobsServiceAvailabilityHealthCheck(Optional.of(serviceUrl),
vertxMock) {
+ @Override
+ public WebClient createClient() {
+ return webClientMock;
+ }
+ };
+ }
+}
diff --git a/quarkus/addons/common/pom.xml b/quarkus/addons/common/pom.xml
index 24200ed798..39ff6e9bdb 100644
--- a/quarkus/addons/common/pom.xml
+++ b/quarkus/addons/common/pom.xml
@@ -37,6 +37,9 @@
<modules>
<module>deployment</module>
<module>reactive-messaging</module>
+ <module>kogito-addons-quarkus-common-health</module>
+ <module>kogito-addons-quarkus-data-index-health</module>
+ <module>kogito-addons-quarkus-jobs-service-health</module>
</modules>
</project>
diff --git a/quarkus/addons/jobs/knative-eventing/runtime/pom.xml
b/quarkus/addons/jobs/knative-eventing/runtime/pom.xml
index 020668a6eb..9d64fd2d2b 100644
--- a/quarkus/addons/jobs/knative-eventing/runtime/pom.xml
+++ b/quarkus/addons/jobs/knative-eventing/runtime/pom.xml
@@ -73,6 +73,10 @@
<groupId>org.kie</groupId>
<artifactId>kogito-addons-quarkus-rest-callback</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-jobs-service-health</artifactId>
+ </dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.mockito</groupId>
diff --git a/quarkus/addons/knative/eventing/runtime/pom.xml
b/quarkus/addons/knative/eventing/runtime/pom.xml
index b8adbd641e..1e8233ccd6 100644
--- a/quarkus/addons/knative/eventing/runtime/pom.xml
+++ b/quarkus/addons/knative/eventing/runtime/pom.xml
@@ -50,6 +50,16 @@
<groupId>io.quarkiverse.reactivemessaging.http</groupId>
<artifactId>quarkus-reactive-messaging-http</artifactId>
</dependency>
+ <!-- must be optional, see:
https://quarkus.io/guides/writing-extensions#extension-health-check -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-smallrye-health</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kogito-addons-quarkus-data-index-health</artifactId>
+ </dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]