This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 3120e20 camel-health - microprofile add cdi annotation as recommended
in the quarkus guide
3120e20 is described below
commit 3120e20507bd5f4cf20418e605bd5cf679e637bd
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat May 30 18:11:55 2020 +0200
camel-health - microprofile add cdi annotation as recommended in the
quarkus guide
---
.../microprofile/health/CamelMicroProfileContextCheck.java | 10 +++++++---
.../microprofile/health/CamelMicroProfileLivenessCheck.java | 6 ++++++
.../microprofile/health/CamelMicroProfileReadinessCheck.java | 6 ++++++
3 files changed, 19 insertions(+), 3 deletions(-)
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
index 6280380..770fb5a 100644
---
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
@@ -19,6 +19,7 @@ package org.apache.camel.microprofile.health;
import java.util.Map;
import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.apache.camel.CamelContext;
@@ -37,6 +38,7 @@ import org.eclipse.microprofile.health.Readiness;
*/
@Readiness
@Liveness
+@ApplicationScoped
public class CamelMicroProfileContextCheck implements HealthCheck,
CamelContextAware {
@Inject
@@ -50,9 +52,11 @@ public class CamelMicroProfileContextCheck implements
HealthCheck, CamelContextA
if (hcr != null) {
// load and register context health check into Camel and use it
here with microprofile
hcr.setId("camel-microprofile-health");
- contextHealthCheck = (org.apache.camel.health.HealthCheck)
hcr.resolveById("context");
- if (contextHealthCheck != null) {
- hcr.register(contextHealthCheck);
+ if (!hcr.getCheck("context").isPresent()) {
+ contextHealthCheck = (org.apache.camel.health.HealthCheck)
hcr.resolveById("context");
+ if (contextHealthCheck != null) {
+ hcr.register(contextHealthCheck);
+ }
}
}
}
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
index af276a7..426b6e0 100644
---
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
@@ -16,9 +16,15 @@
*/
package org.apache.camel.microprofile.health;
+import javax.enterprise.context.ApplicationScoped;
+
import org.eclipse.microprofile.health.Liveness;
+/**
+ * Liveness checks
+ */
@Liveness
+@ApplicationScoped
public class CamelMicroProfileLivenessCheck extends
AbstractCamelMicroProfileHealthCheck {
@Override
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
index 6a09366..8ab254d 100644
---
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
@@ -16,9 +16,15 @@
*/
package org.apache.camel.microprofile.health;
+import javax.enterprise.context.ApplicationScoped;
+
import org.eclipse.microprofile.health.Readiness;
+/**
+ * Readiness checks
+ */
@Readiness
+@ApplicationScoped
public class CamelMicroProfileReadinessCheck extends
AbstractCamelMicroProfileHealthCheck {
@Override