The Health Check Java API

Most of the plumbing is performed by the application framework that implements the MP-HC specification. Your part is to decide how liveness or readiness are determined through the health check procedures that your microservice defines using the MP-HC API.

To do this, you need to implement a health check procedure by implementing one or more instances of the HealthCheck interface using beans that are marked with a Health annotation.

The HealthCheck interface is provided in the following code block:

package org.eclipse.microprofile.health;@FunctionalInterfacepublic interface HealthCheck {  HealthCheckResponse call();}

The code for the Health annotation is provided in the following code block:

package org.eclipse.microprofile.health; ...

Get Hands-On Enterprise Java Microservices with Eclipse MicroProfile now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.