Skip to content

Commit

Permalink
microprofile-health-35 Provide different types of health check
Browse files Browse the repository at this point in the history
Introduce qualifiers

Signed-off-by: Antoine Sabot-Durand <antoine@sabot-durand.net>
  • Loading branch information
antoinesd committed Dec 13, 2018
1 parent 72af458 commit 8f6f64b
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions spec/src/main/asciidoc/java-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

= Java API Usage

The specification provides 2 main API for Liveness and Readiness
The specification provides the following API for Liveness and Readiness


== Liveness check
== Common API check

The main API to provide health check procedures on the application level is the `HealthCheck` interface:
The main API to provide health check procedures (liveness or Readiness) on the application level is the `HealthCheck` interface:

```
@FunctionalInterface
Expand Down Expand Up @@ -57,27 +57,20 @@ public abstract class HealthCheckResponse {

The status of all `HealthCheck` 's determines the overall status.

== Liveness check

== Readiness check
The `@Liveness` qualifier can be applied on an `HealthCheck` implementation to indicate that this bean is dedicated to Liveness check.

The API which provides readiness check procedure on the application level is the `ReadinessCheck` interface:
To provide backward compatibility with previous specification version, an `HealthCheck` implementation with `@Health` or no qualifier (i.e. `@Default` qualifier) is also considered as a liveness procedure.

```
@FunctionalInterface
public interface ReadinessCheck {
//TODO: is support for default necessary (is it suppoirted in 1.0) ?

HealthCheckResponse call();
}
```

Applications provide readiness check procedures (implementation of a `ReadinessCheck`), which will be used by the
the runtime hosting the application to verify if the computing node is ready to answer requests.

There can be one or several `ReadinessCheck` exposed, they will all be invoked when an inbound protocol request is received (i.e. HTTP).

The runtime will `call()` each `ReadinessCheck` which in turn creates a `HealthCheckResponse` that signals if the service is ready to a consuming end
== Readiness check

The `@Readiness` qualifier must be applied on an `HealthCheck` implementation to indicate that this bean is dedicated to Liveness check.

//TODO: support of both qualifier?

== Constructing `HealthCheckResponse` 's

Expand Down Expand Up @@ -112,7 +105,7 @@ public class CheckDiskspace implements HealthCheck {

= Integration with CDI

Any enabled bean with a bean of type `org.eclipse.microprofile.health.HealthCheck` and default qualifier that can be used as health check procedure.
Any enabled bean with a bean of type `org.eclipse.microprofile.health.HealthCheck` and liveness, readiness or default qualifier that can be used as health check procedure.

In addition, for backward compatibility with version 1.0 of the current specification, any enabled bean with a bean of type `org.eclipse.microprofile.health.HealthCheck` and `@Health` qualifier.

Expand Down

0 comments on commit 8f6f64b

Please sign in to comment.