Class HealthCheckResponse

java.lang.Object
org.eclipse.microprofile.health.HealthCheckResponse

public class HealthCheckResponse extends Object
The response to a health check invocation.

The HealthCheckResponse class is reserved for an extension by implementation providers. An application should use one of the static methods to create a Response instance using a HealthCheckResponseBuilder. When used on the consuming end, The class can also be instantiated directly.

  • Constructor Details

    • HealthCheckResponse

      public HealthCheckResponse(String name, HealthCheckResponse.Status status, Optional<Map<String,Object>> data)
      Constructor allowing instantiation from 3rd party framework like MicroProfile Rest client
      Parameters:
      name - Health Check procedure's name
      status - Health Check procedure's status
      data - additional data for Health Check procedure
    • HealthCheckResponse

      public HealthCheckResponse()
      Default constructor
  • Method Details

    • setResponseProvider

      public static void setResponseProvider(HealthCheckResponseProvider provider)
      Used by OSGi environment where the service loader pattern is not supported.
      Parameters:
      provider - the provider instance to use.
    • named

      public static HealthCheckResponseBuilder named(String name)
      Creates a HealthCheckResponseBuilder with a name.
      Parameters:
      name - the check name
      Returns:
      a new health check builder with a name
    • builder

      public static HealthCheckResponseBuilder builder()
      Creates an empty HealthCheckResponseBuilder. Note: The health check response name is required and needs to be set before the response is constructed.
      Returns:
      a new, empty health check builder
    • up

      public static HealthCheckResponse up(String name)
      Creates a successful health check with a name.
      Parameters:
      name - the check name
      Returns:
      a new sucessful health check response with a name
    • down

      public static HealthCheckResponse down(String name)
      Creates a failed health check with a name.
      Parameters:
      name - the check name
      Returns:
      a new failed health check response with a name
    • getName

      public String getName()
    • getStatus

      public HealthCheckResponse.Status getStatus()
    • getData

      public Optional<Map<String,Object>> getData()