This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 95e6073 CAMEL-13875: Support for MicroProfile Health 95e6073 is described below commit 95e6073272a39fcc8e76e46a94d77d9132d1be5f Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Fri Oct 11 10:40:15 2019 +0100 CAMEL-13875: Support for MicroProfile Health --- apache-camel/pom.xml | 5 + apache-camel/src/main/descriptors/common-bin.xml | 1 + bom/camel-bom/pom.xml | 5 + components/camel-microprofile-health/pom.xml | 116 ++++++++++ .../main/docs/microprofile-health-component.adoc | 48 +++++ .../AbstractCamelMicroProfileHealthCheck.java | 95 +++++++++ .../AbstractCamelMicroProfileLivenessCheck.java | 37 ++++ .../AbstractCamelMicroProfileReadinessCheck.java | 37 ++++ .../health/CamelMicroProfileContextCheck.java | 81 +++++++ .../health/CamelMicroProfileLivenessCheck.java | 33 +++ .../health/CamelMicroProfileReadinessCheck.java | 33 +++ ...CamelMicroProfileHealthCheckRepositoryTest.java | 89 ++++++++ .../health/CamelMicroProfileHealthCheckTest.java | 233 +++++++++++++++++++++ .../health/CamelMicroProfileHealthTestSupport.java | 87 ++++++++ .../src/test/resources/log4j2.properties | 28 +++ components/pom.xml | 1 + components/readme.adoc | 4 +- docs/components/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/microprofile-health-component.adoc | 47 +++++ parent/pom.xml | 9 +- .../camel-spring-boot-dependencies/pom.xml | 5 + .../maven/packaging/SpringBootStarterMojo.java | 1 + 22 files changed, 994 insertions(+), 2 deletions(-) diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index 505dd0a..4ef03c1 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -998,6 +998,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-microprofile-health</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-microprofile-metrics</artifactId> <version>${project.version}</version> </dependency> diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 404e758..1e65b8b 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -220,6 +220,7 @@ <include>org.apache.camel:camel-metrics</include> <include>org.apache.camel:camel-micrometer</include> <include>org.apache.camel:camel-microprofile-config</include> + <include>org.apache.camel:camel-microprofile-health</include> <include>org.apache.camel:camel-microprofile-metrics</include> <include>org.apache.camel:camel-milo</include> <include>org.apache.camel:camel-mina</include> diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index a15a7cb..9a05f39 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1910,6 +1910,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-microprofile-health</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-microprofile-metrics</artifactId> <version>${project.version}</version> </dependency> diff --git a/components/camel-microprofile-health/pom.xml b/components/camel-microprofile-health/pom.xml new file mode 100644 index 0000000..fb98851 --- /dev/null +++ b/components/camel-microprofile-health/pom.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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: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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>components</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-microprofile-health</artifactId> + <packaging>jar</packaging> + + <name>Camel :: MicroProfile Health</name> + <description>Bridging Eclipse MicroProfile Health with Camel health checks</description> + + <properties> + <firstVersion>3.0.0</firstVersion> + <label>microservice</label> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-base</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.eclipse.microprofile.health</groupId> + <artifactId>microprofile-health-api</artifactId> + <version>${microprofile-health-version}</version> + <scope>provided</scope> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>io.smallrye</groupId> + <artifactId>smallrye-health</artifactId> + <version>${smallrye-health-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.smallrye</groupId> + <artifactId>smallrye-config-1.3</artifactId> + <version>${smallrye-config-version}</version> + <scope>test</scope> + </dependency> + + <!-- JSON support for smallrye-health --> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-json_1.1_spec</artifactId> + <version>${geronimo-json-spec-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.johnzon</groupId> + <artifactId>johnzon-core</artifactId> + <version>${johnzon-version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> +</project> diff --git a/components/camel-microprofile-health/src/main/docs/microprofile-health-component.adoc b/components/camel-microprofile-health/src/main/docs/microprofile-health-component.adoc new file mode 100644 index 0000000..7cccbb3 --- /dev/null +++ b/components/camel-microprofile-health/src/main/docs/microprofile-health-component.adoc @@ -0,0 +1,48 @@ +[[MicroProfileHealth-MicroProfileHealthComponent]] += MicroProfile Health Component + +*Available as of Camel 3.0* + +The microprofile-health component is used for bridging https://microprofile.io/project/eclipse/microprofile-health[Eclipse MicroProfile Health] checks with Camel's own Health Check API. + +This enables you to write checks using the Camel health APIs and have them exposed via MicroProfile Health readiness and liveness checks. + +=== Usage + +By default, Camel health checks are registered as both MicroProfile Health liveness and readiness checks. To have finer control over whether a Camel health check should +be considered either a readiness or liveness check, you can extend the `AbstractCamelMicroProfileLivenessCheck` and `AbstractCamelMicroProfileReadinessCheck` classes. + +For example, to have a check registered exclusively as a liveness check: + +[source,java] +---- +public class MyHealthCheck extends AbstractCamelMicroProfileLivenessCheck { + + public MyHealthCheck() { + super("my-liveness-check-id"); + getConfiguration().setEnabled(true); + } + + @Override + protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) { + builder.detail("some-detail-key", "some-value"); + + if (someSuccessCondition) { + builder.up(); + } else { + builder.down(); + } + } +} +---- + +=== Auto discovery + +The expectation is that this component is run within a MicroProfile container, where CDI and a library implementing the MicroProfile health specification is available. +E.g https://github.com/smallrye/smallrye-health[SmallRye Health]. + +In this scenario, the readiness and liveness checks are automatically discovered and registered for you. + +However, it's still possible to manually +register Health checks without CDI. Ensure your camel health checks are available in the Camel registry and add an instance of +`CamelMicroProfileReadinessCheck` and `CamelMicroProfileLivenessCheck` to the health check registry of your MicroProfile Health implementation. diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java new file mode 100644 index 0000000..5e55165 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java @@ -0,0 +1,95 @@ +/* + * 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.apache.camel.microprofile.health; + +import java.util.Collection; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.health.HealthCheck.Result; +import org.apache.camel.health.HealthCheck.State; +import org.apache.camel.health.HealthCheckFilter; +import org.apache.camel.health.HealthCheckHelper; +import org.apache.camel.impl.health.AbstractHealthCheck; +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.HealthCheckResponseBuilder; + +/** + * Invokes Camel health checks and adds their results into the HealthCheckResponseBuilder + */ +public abstract class AbstractCamelMicroProfileHealthCheck implements HealthCheck, CamelContextAware { + + @Inject + protected CamelContext camelContext; + + @Override + public HealthCheckResponse call() { + final HealthCheckResponseBuilder builder = HealthCheckResponse.builder(); + builder.name(getHealthCheckName()); + + if (camelContext != null) { + Collection<Result> results = HealthCheckHelper.invoke(camelContext, (HealthCheckFilter) check -> check.getGroup() != null && check.getGroup().equals(getHealthGroupFilterExclude())); + if (!results.isEmpty()) { + builder.up(); + } + + for (Result result: results) { + Map<String, Object> details = result.getDetails(); + boolean enabled = true; + + if (details.containsKey(AbstractHealthCheck.CHECK_ENABLED)) { + enabled = (boolean) details.get(AbstractHealthCheck.CHECK_ENABLED); + } + + if (enabled) { + builder.withData(result.getCheck().getId(), result.getState().name()); + if (result.getState() == State.DOWN) { + builder.down(); + } + } + } + } + + return builder.build(); + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return this.camelContext; + } + + /** + * Gets the name of a specific health group to exclude when invoking a Camel HealthCheck + * @return the health group to exclude + */ + abstract String getHealthGroupFilterExclude(); + + /** + * Gets the name of the health check which will be used as a heading for the associated checks. + * @return the health check name + */ + abstract String getHealthCheckName(); +} diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileLivenessCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileLivenessCheck.java new file mode 100644 index 0000000..a971496 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileLivenessCheck.java @@ -0,0 +1,37 @@ +/* + * 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.apache.camel.microprofile.health; + +import java.util.Map; + +import org.apache.camel.impl.health.AbstractHealthCheck; + +/** + * Ensures the implemented health check will be considered as a MicroProfile Health liveness check + */ +public abstract class AbstractCamelMicroProfileLivenessCheck extends AbstractHealthCheck { + + public static final String HEALTH_GROUP_LIVENESS = "camel.health.liveness"; + + public AbstractCamelMicroProfileLivenessCheck(String id) { + super(HEALTH_GROUP_LIVENESS, id); + } + + public AbstractCamelMicroProfileLivenessCheck(String id, Map<String, Object> meta) { + super(HEALTH_GROUP_LIVENESS, id, meta); + } +} diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileReadinessCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileReadinessCheck.java new file mode 100644 index 0000000..c9a91a1 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileReadinessCheck.java @@ -0,0 +1,37 @@ +/* + * 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.apache.camel.microprofile.health; + +import java.util.Map; + +import org.apache.camel.impl.health.AbstractHealthCheck; + +/** + * Ensures the implemented health check will be considered as a MicroProfile Health readiness check + */ +public abstract class AbstractCamelMicroProfileReadinessCheck extends AbstractHealthCheck { + + public static final String HEALTH_GROUP_READINESS = "camel.health.readiness"; + + public AbstractCamelMicroProfileReadinessCheck(String id) { + super(HEALTH_GROUP_READINESS, id); + } + + public AbstractCamelMicroProfileReadinessCheck(String id, Map<String, Object> meta) { + super(HEALTH_GROUP_READINESS, id, meta); + } +} diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java new file mode 100644 index 0000000..f5fb772 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileContextCheck.java @@ -0,0 +1,81 @@ +/* + * 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.apache.camel.microprofile.health; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.health.HealthCheck.Result; +import org.apache.camel.health.HealthCheck.State; +import org.apache.camel.impl.health.ContextHealthCheck; +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.HealthCheckResponseBuilder; +import org.eclipse.microprofile.health.Liveness; +import org.eclipse.microprofile.health.Readiness; + +/** + * A simple health check implementation for checking the status of a CamelContext + */ +@Readiness +@Liveness +public class CamelMicroProfileContextCheck implements HealthCheck, CamelContextAware { + + @Inject + private CamelContext camelContext; + + private ContextHealthCheck contextHealthCheck = new ContextHealthCheck(); + + public CamelMicroProfileContextCheck() { + contextHealthCheck.getConfiguration().setEnabled(true); + } + + @Override + public HealthCheckResponse call() { + final HealthCheckResponseBuilder builder = HealthCheckResponse.builder(); + builder.name("camel"); + builder.down(); + + if (camelContext != null) { + contextHealthCheck.setCamelContext(camelContext); + + Result result = contextHealthCheck.call(); + Map<String, Object> details = result.getDetails(); + builder.withData("name", details.get("context.name").toString()); + builder.withData("contextStatus", details.get("context.status").toString()); + + if (result.getState().equals(State.UP)) { + builder.up(); + } + } + + return builder.build(); + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return this.camelContext; + } +} diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileLivenessCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileLivenessCheck.java new file mode 100644 index 0000000..af276a7 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileLivenessCheck.java @@ -0,0 +1,33 @@ +/* + * 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.apache.camel.microprofile.health; + +import org.eclipse.microprofile.health.Liveness; + +@Liveness +public class CamelMicroProfileLivenessCheck extends AbstractCamelMicroProfileHealthCheck { + + @Override + String getHealthGroupFilterExclude() { + return AbstractCamelMicroProfileReadinessCheck.HEALTH_GROUP_READINESS; + } + + @Override + String getHealthCheckName() { + return "camel-liveness-checks"; + } +} diff --git a/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileReadinessCheck.java b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileReadinessCheck.java new file mode 100644 index 0000000..6a09366 --- /dev/null +++ b/components/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/CamelMicroProfileReadinessCheck.java @@ -0,0 +1,33 @@ +/* + * 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.apache.camel.microprofile.health; + +import org.eclipse.microprofile.health.Readiness; + +@Readiness +public class CamelMicroProfileReadinessCheck extends AbstractCamelMicroProfileHealthCheck { + + @Override + String getHealthGroupFilterExclude() { + return AbstractCamelMicroProfileLivenessCheck.HEALTH_GROUP_LIVENESS; + } + + @Override + String getHealthCheckName() { + return "camel-readiness-checks"; + } +} diff --git a/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckRepositoryTest.java b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckRepositoryTest.java new file mode 100644 index 0000000..58fc6d4 --- /dev/null +++ b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckRepositoryTest.java @@ -0,0 +1,89 @@ +/* + * 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.apache.camel.microprofile.health; + +import javax.json.JsonArray; +import javax.json.JsonObject; + +import io.smallrye.health.SmallRyeHealth; + +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.health.HealthCheckRegistry; +import org.apache.camel.impl.health.RoutesHealthCheckRepository; +import org.eclipse.microprofile.health.HealthCheckResponse.State; +import org.junit.Test; + +public class CamelMicroProfileHealthCheckRepositoryTest extends CamelMicroProfileHealthTestSupport { + + @Test + public void testCamelHealthRepositoryUpStatus() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + healthCheckRegistry.addRepository(new RoutesHealthCheckRepository()); + + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.UP.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.UP, checks.getJsonObject(0), jsonObject -> { + assertEquals(State.UP.name(), jsonObject.getString("route:healthyRoute")); + }); + } + + @Test + public void testCamelHealthRepositoryDownStatus() throws Exception { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + healthCheckRegistry.addRepository(new RoutesHealthCheckRepository()); + + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + context.getRouteController().stopRoute("healthyRoute"); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.DOWN.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.DOWN, checks.getJsonObject(0), jsonObject -> { + assertEquals(State.DOWN.name(), jsonObject.getString("route:healthyRoute")); + }); + } + + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start").routeId("healthyRoute") + .setBody(constant("Hello Camel MicroProfile Health")); + } + }; + } +} diff --git a/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java new file mode 100644 index 0000000..4b34306 --- /dev/null +++ b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java @@ -0,0 +1,233 @@ +/* + * 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.apache.camel.microprofile.health; + +import javax.json.JsonArray; +import javax.json.JsonObject; + +import io.smallrye.health.SmallRyeHealth; + +import org.apache.camel.ServiceStatus; +import org.apache.camel.health.HealthCheckRegistry; +import org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy; +import org.eclipse.microprofile.health.HealthCheckResponse.State; +import org.junit.Test; + +public class CamelMicroProfileHealthCheckTest extends CamelMicroProfileHealthTestSupport { + + @Test + public void testCamelContextHealthCheckUpStatus() { + context.setNameStrategy(new ExplicitCamelContextNameStrategy("health-context")); + CamelMicroProfileContextCheck check = new CamelMicroProfileContextCheck(); + check.setCamelContext(context); + reporter.addHealthCheck(check); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + + assertEquals(State.UP.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel", State.UP, checks.getJsonObject(0), (checksJson) -> { + assertEquals(ServiceStatus.Started.toString(), checksJson.getString("contextStatus")); + assertEquals("health-context", checksJson.getString("name")); + }); + } + + @Test + public void testCamelContextHealthCheckDownStatus() { + context.setNameStrategy(new ExplicitCamelContextNameStrategy("health-context")); + CamelMicroProfileContextCheck check = new CamelMicroProfileContextCheck(); + check.setCamelContext(context); + reporter.addHealthCheck(check); + + context.stop(); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + + assertEquals(State.DOWN.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel", State.DOWN, checks.getJsonObject(0), (checksJson) -> { + assertEquals(ServiceStatus.Stopped.toString(), checksJson.getString("contextStatus")); + assertEquals("health-context", checksJson.getString("name")); + }); + } + + @Test + public void testCamelMicroProfileLivenessCheckUpStatus() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + + healthCheckRegistry.register(createLivenessCheck("liveness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createLivenessCheck("liveness-2", true, builder -> builder.up())); + healthCheckRegistry.register(createReadinessCheck("readiness-3", true, builder -> builder.up())); + + CamelMicroProfileLivenessCheck livenessCheck = new CamelMicroProfileLivenessCheck(); + livenessCheck.setCamelContext(context); + reporter.addHealthCheck(livenessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.UP.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + JsonObject checksObject = checks.getJsonObject(0); + assertHealthCheckOutput("camel-liveness-checks", State.UP, checksObject, checksJson -> { + assertEquals(State.UP.name(), checksJson.getString("liveness-1")); + assertEquals(State.UP.name(), checksJson.getString("liveness-2")); + }); + } + + @Test + public void testCamelMicroProfileLivenessCheckDownStatus() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + + healthCheckRegistry.register(createLivenessCheck("liveness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createLivenessCheck("liveness-2", true, builder -> builder.down())); + healthCheckRegistry.register(createReadinessCheck("readiness-3", true, builder -> builder.up())); + + CamelMicroProfileLivenessCheck livenessCheck = new CamelMicroProfileLivenessCheck(); + livenessCheck.setCamelContext(context); + reporter.addHealthCheck(livenessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.DOWN.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + JsonObject checksObject = checks.getJsonObject(0); + assertHealthCheckOutput("camel-liveness-checks", State.DOWN, checksObject, checksJson -> { + assertEquals(State.UP.name(), checksJson.getString("liveness-1")); + assertEquals(State.DOWN.name(), checksJson.getString("liveness-2")); + }); + } + + @Test + public void testCamelMicroProfileReadinessCheckUpStatus() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + + healthCheckRegistry.register(createLivenessCheck("liveness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createReadinessCheck("readiness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createReadinessCheck("readiness-2", true, builder -> builder.up())); + + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.UP.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.UP, checks.getJsonObject(0), jsonObject -> { + assertEquals(State.UP.name(), jsonObject.getString("readiness-1")); + assertEquals(State.UP.name(), jsonObject.getString("readiness-2")); + }); + } + + @Test + public void testCamelMicroProfileReadinessCheckDownStatus() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + + healthCheckRegistry.register(createLivenessCheck("liveness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createReadinessCheck("readiness-1", true, builder -> builder.up())); + healthCheckRegistry.register(createReadinessCheck("readiness-2", true, builder -> builder.down())); + + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.DOWN.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.DOWN, checks.getJsonObject(0), jsonObject -> { + assertEquals(State.UP.name(), jsonObject.getString("readiness-1")); + assertEquals(State.DOWN.name(), jsonObject.getString("readiness-2")); + }); + } + + @Test + public void testCamelHealthCheckDisabled() { + HealthCheckRegistry healthCheckRegistry = HealthCheckRegistry.get(context); + + healthCheckRegistry.register(createReadinessCheck("disabled-check", false, builder -> builder.up())); + + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.UP.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(1, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.UP, checks.getJsonObject(0), jsonObject -> { + assertNull(jsonObject); + }); + } + + @Test + public void testNoCamelHealthChecksRegistered() { + CamelMicroProfileReadinessCheck readinessCheck = new CamelMicroProfileReadinessCheck(); + readinessCheck.setCamelContext(context); + reporter.addHealthCheck(readinessCheck); + + CamelMicroProfileLivenessCheck livenessCheck = new CamelMicroProfileLivenessCheck(); + livenessCheck.setCamelContext(context); + reporter.addHealthCheck(livenessCheck); + + SmallRyeHealth health = reporter.getHealth(); + + JsonObject healthObject = getHealthJson(health); + assertEquals(State.DOWN.name(), healthObject.getString("status")); + + JsonArray checks = healthObject.getJsonArray("checks"); + assertEquals(2, checks.size()); + + assertHealthCheckOutput("camel-readiness-checks", State.DOWN, checks.getJsonObject(0), jsonObject -> { + assertNull(jsonObject); + }); + + assertHealthCheckOutput("camel-liveness-checks", State.DOWN, checks.getJsonObject(1), jsonObject -> { + assertNull(jsonObject); + }); + } +} diff --git a/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java new file mode 100644 index 0000000..bc2cb99 --- /dev/null +++ b/components/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java @@ -0,0 +1,87 @@ +/* + * 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.apache.camel.microprofile.health; + +import java.io.ByteArrayOutputStream; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.function.Consumer; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.stream.JsonParser; + +import io.smallrye.health.SmallRyeHealth; +import io.smallrye.health.SmallRyeHealthReporter; + +import org.apache.camel.health.HealthCheck; +import org.apache.camel.health.HealthCheckResultBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.eclipse.microprofile.health.HealthCheckResponse; + +public class CamelMicroProfileHealthTestSupport extends CamelTestSupport { + + protected SmallRyeHealthReporter reporter; + + @Override + public void setUp() throws Exception { + super.setUp(); + reporter = new SmallRyeHealthReporter(); + } + + protected void assertHealthCheckOutput(String expectedName, HealthCheckResponse.State expectedState, JsonObject healthObject, Consumer<JsonObject> dataObjectAssertions) { + assertEquals(expectedName, healthObject.getString("name")); + assertEquals(expectedState.name(), healthObject.getString("status")); + dataObjectAssertions.accept(healthObject.getJsonObject("data")); + } + + protected JsonObject getHealthJson(SmallRyeHealth health) { + JsonParser parser = Json.createParser(new StringReader(getHealthOutput(health))); + assertTrue("Health check content is empty", parser.hasNext()); + parser.next(); + return parser.getObject(); + } + + protected String getHealthOutput(SmallRyeHealth health) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + reporter.reportHealth(outputStream, health); + return new String(outputStream.toByteArray(), StandardCharsets.UTF_8); + } + + protected HealthCheck createLivenessCheck(String id, boolean enabled, Consumer<HealthCheckResultBuilder> consumer) { + HealthCheck healthCheck = new AbstractCamelMicroProfileLivenessCheck(id) { + @Override + protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) { + consumer.accept(builder); + } + }; + healthCheck.getConfiguration().setEnabled(enabled); + return healthCheck; + } + + protected HealthCheck createReadinessCheck(String id, boolean enabled, Consumer<HealthCheckResultBuilder> consumer) { + HealthCheck healthCheck = new AbstractCamelMicroProfileReadinessCheck(id) { + @Override + protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) { + consumer.accept(builder); + } + }; + healthCheck.getConfiguration().setEnabled(enabled); + return healthCheck; + } +} diff --git a/components/camel-microprofile-health/src/test/resources/log4j2.properties b/components/camel-microprofile-health/src/test/resources/log4j2.properties new file mode 100644 index 0000000..f142ebc --- /dev/null +++ b/components/camel-microprofile-health/src/test/resources/log4j2.properties @@ -0,0 +1,28 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-microprofile-health-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file diff --git a/components/pom.xml b/components/pom.xml index a650994..4d69e9e 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -239,6 +239,7 @@ <module>camel-metrics</module> <module>camel-micrometer</module> <module>camel-microprofile-config</module> + <module>camel-microprofile-health</module> <module>camel-microprofile-metrics</module> <module>camel-milo</module> <module>camel-mina</module> diff --git a/components/readme.adoc b/components/readme.adoc index 033efdb..3b7f65e 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -1062,7 +1062,7 @@ Number of Languages: 17 in 11 JAR artifacts (0 deprecated) == Miscellaneous Components // others: START -Number of Miscellaneous Components: 36 in 36 JAR artifacts (0 deprecated) +Number of Miscellaneous Components: 37 in 37 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -1088,6 +1088,8 @@ Number of Miscellaneous Components: 36 in 36 JAR artifacts (0 deprecated) | link:camel-microprofile-config/src/main/docs/microprofile-config.adoc[Microprofile Config] (camel-microprofile-config) | 3.0 | Bridging Eclipse MicroProfile Config with Camel properties +| link:camel-microprofile-health/src/main/docs/microprofile-health.adoc[Microprofile Health] (camel-microprofile-health) | 3.0 | Bridging Eclipse MicroProfile Health with Camel health checks + | link:camel-opentracing/src/main/docs/opentracing.adoc[OpenTracing] (camel-opentracing) | 2.19 | Distributed tracing using OpenTracing | link:camel-reactive-executor-vertx/src/main/docs/reactive-executor-vertx.adoc[Reactive Executor Vertx] (camel-reactive-executor-vertx) | 3.0 | Reactive Executor for camel-core using Vert X diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index ffe054b..3fa4cb9 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -235,6 +235,7 @@ * xref:metrics-component.adoc[Metrics Component] * xref:micrometer-component.adoc[Micrometer Component] * xref:microprofile-config.adoc[MicroProfile Config Component] +* xref:microprofile-health-component.adoc[MicroProfile Health Component] * xref:microprofile-metrics-component.adoc[MicroProfile Metrics Component] * xref:milo-client-component.adoc[OPC UA Client Component] * xref:milo-server-component.adoc[OPC UA Server Component] diff --git a/docs/components/modules/ROOT/pages/microprofile-health-component.adoc b/docs/components/modules/ROOT/pages/microprofile-health-component.adoc new file mode 100644 index 0000000..db4bd42 --- /dev/null +++ b/docs/components/modules/ROOT/pages/microprofile-health-component.adoc @@ -0,0 +1,47 @@ +[[MicroProfileHealth-MicroProfileHealthComponent]] += MicroProfile Health Component +:page-source: components/camel-microprofile-health/src/main/docs/microprofile-health-component.adoc + +*Available as of Camel 3.0* + +The microprofile-health component is used for bridging Eclipse MicroProfile Health checks with Camel's own Health Check API. + +This enables you to write health checks using Camel health APIs and have them available as MicroProfile Health readiness and liveness checks. + +=== Usage + +By default, Camel health checks are available as both MicroProfile Health liveness and readiness checks. To have finer control on whether a Camel health check should +be considered either a readiness or liveness check, you can extend the `AbstractCamelMicroProfileLivenessCheck` and `AbstractCamelMicroProfileReadinessCheck` classes. + +For example, to have a check registered exclusively as a liveness check: + +[source,java] +---- +public class MyHealthCheck extends AbstractCamelMicroProfileLivenessCheck { + + public MyHealthCheck() { + super("my-liveness-check-id"); + getConfiguration().setEnabled(true); + } + + @Override + protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) { + builder.detail("some-detail-key", "some-value"); + + if (someSuccessCondition) { + builder.up(); + } else { + builder.down(); + } + } +} +---- + +=== Auto discovery + +The expectation is that this component is run within a MicroProfile container, where CDI and a library implementing the MicroProfile health specification is available. +In this scenario, the readiness and liveness checks are automatically discovered and registered for you. + +However, it's still possible to manually +register Health checks without CDI. Ensure your camel health checks are available in the Camel registry and add an instance of +`CamelMicroProfileReadinessCheck` and `CamelMicroProfileLivenessCheck` to the health check registry of your MicroProfile Health implementation. diff --git a/parent/pom.xml b/parent/pom.xml index fb8a65f..a8852cf 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -454,6 +454,7 @@ <micrometer-version>1.2.2</micrometer-version> <microprofile-config-version>1.3</microprofile-config-version> <microprofile-metrics-version>2.0.0</microprofile-metrics-version> + <microprofile-health-version>2.0.1</microprofile-health-version> <milo-version>0.2.5</milo-version> <mimepull-version>1.9.12</mimepull-version> <mina-version>2.0.21</mina-version> @@ -570,7 +571,8 @@ <slf4j-version>1.7.28</slf4j-version> <smack-version>4.3.4</smack-version> <smallrye-config-version>1.0.0</smallrye-config-version> - <smallrye-metrics-version>1.1.0</smallrye-metrics-version> + <smallrye-metrics-version>1.1.0</smallrye-metrics-version> + <smallrye-health-version>2.0.0</smallrye-health-version> <snakeyaml-version>1.25</snakeyaml-version> <snappy-version>1.1.4</snappy-version> <snmp4j-version>2.6.3_1</snmp4j-version> @@ -1717,6 +1719,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-microprofile-health</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-microprofile-metrics</artifactId> <version>${project.version}</version> </dependency> diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index 6a7d3fc..e471994 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -2140,6 +2140,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-microprofile-health</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-microprofile-metrics</artifactId> <version>${project.version}</version> </dependency> diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java index d597b78..e907407 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java @@ -78,6 +78,7 @@ public class SpringBootStarterMojo extends AbstractMojo { /* extended core */ "camel-attachments", /* Java EE -> */ "camel-cdi", /* MicroProfile -> */ "camel-microprofile-config", + /* MicroProfile -> */ "camel-microprofile-health", /* MicroProfile -> */ "camel-microprofile-metrics", /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-ibatis", /* currently incompatible */ "camel-spark-rest",