From ce08ef13616e92624ac9254b0aacd918da6a02c6 Mon Sep 17 00:00:00 2001 From: Antoine Sabot-Durand Date: Thu, 29 Nov 2018 17:55:34 +0100 Subject: [PATCH 1/3] microprofile-health-36 Add example where Health procedures are produced instead of defined by bean class fixes #36 Signed-off-by: Antoine Sabot-Durand --- spec/src/main/asciidoc/java-api.adoc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/spec/src/main/asciidoc/java-api.adoc b/spec/src/main/asciidoc/java-api.adoc index 3c216a6..11bdbb6 100644 --- a/spec/src/main/asciidoc/java-api.adoc +++ b/spec/src/main/asciidoc/java-api.adoc @@ -27,8 +27,7 @@ public interface HealthCheck { } ``` -Applications provide health check procedures (implementation of a `HealthCheck`), which will be used by the -the runtime hosting the application to verify the healthiness of the computing node. +Applications provide health check procedures (implementation of a `HealthCheck`), which will be used by the the runtime hosting the application to verify the healthiness of the computing node. There can be one or several `HealthCheck` exposed, they will all be invoked when an inbound protocol request is received (i.e. HTTP). @@ -102,3 +101,24 @@ public class MyCheck implements HealthCheck { } } ``` + +As health check procedures are CDI bean they can also be defined with CDI producers: + + +``` +@ApplicationScoped +class MyChecks { + + @Produces + @ApplicationScoped + HealthCheck check1() { + return () -> return HealthStatus.state(getMemUsage() < 90%); + } + + @Produces + @ApplicationScoped + HealthCheck check2() { + return () -> HealthStatus.state(getCpuUsage() < 90%); + } +}} +``` \ No newline at end of file From 232e9b9f5e6e20cf7676a46b92196177121a4d6a Mon Sep 17 00:00:00 2001 From: Antoine Sabot-Durand Date: Thu, 6 Dec 2018 17:36:25 +0100 Subject: [PATCH 2/3] microprofile-health-36 Add example where Health procedures are produced instead of defined by bean class correct examples Signed-off-by: Antoine Sabot-Durand --- spec/src/main/asciidoc/java-api.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/src/main/asciidoc/java-api.adoc b/spec/src/main/asciidoc/java-api.adoc index 11bdbb6..fcf83be 100644 --- a/spec/src/main/asciidoc/java-api.adoc +++ b/spec/src/main/asciidoc/java-api.adoc @@ -112,13 +112,13 @@ class MyChecks { @Produces @ApplicationScoped HealthCheck check1() { - return () -> return HealthStatus.state(getMemUsage() < 90%); + return () -> return HealthStatus.state(getMemUsage() < 0.9); } @Produces @ApplicationScoped HealthCheck check2() { - return () -> HealthStatus.state(getCpuUsage() < 90%); + return () -> HealthStatus.state(getCpuUsage() < 0.9); } }} ``` \ No newline at end of file From 2e5308b246a1692c886104364d07330c704a039b Mon Sep 17 00:00:00 2001 From: Antoine Sabot-Durand Date: Thu, 13 Dec 2018 10:13:01 +0100 Subject: [PATCH 3/3] microprofile-health-36 Add example where Health procedures are produced instead of defined by bean class add more feedback Signed-off-by: Antoine Sabot-Durand --- spec/src/main/asciidoc/java-api.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/src/main/asciidoc/java-api.adoc b/spec/src/main/asciidoc/java-api.adoc index fcf83be..80fd169 100644 --- a/spec/src/main/asciidoc/java-api.adoc +++ b/spec/src/main/asciidoc/java-api.adoc @@ -27,7 +27,7 @@ public interface HealthCheck { } ``` -Applications provide health check procedures (implementation of a `HealthCheck`), which will be used by the the runtime hosting the application to verify the healthiness of the computing node. +Applications provide health check procedures (implementation of a `HealthCheck`), which will be used by the runtime hosting the application to verify the healthiness of the computing node. There can be one or several `HealthCheck` exposed, they will all be invoked when an inbound protocol request is received (i.e. HTTP). @@ -112,7 +112,7 @@ class MyChecks { @Produces @ApplicationScoped HealthCheck check1() { - return () -> return HealthStatus.state(getMemUsage() < 0.9); + return () -> HealthStatus.state(getMemUsage() < 0.9); } @Produces