Interface HealthRegistry


  • @Experimental("Programmatic Health API")
    public interface HealthRegistry

    Programmatic API for the dynamic registrations and removals of health check procedures.

    The HealthRegistry can be injected as a CDI bean with two qualifiers:

    • Liveness
     @Inject
     @Liveness
     HealthRegistry livenessHealthRegistry;
     
    • Readiness:
     @Inject
     @Readiness
     HealthRegistry readinessHealthRegistry;
     
    • Method Detail

      • register

        HealthRegistry register​(String id,
                                org.eclipse.microprofile.health.HealthCheck healthCheck)
        Programmatic registration of a HealthCheck instances.
        Parameters:
        id - the id of the registered check which can be later used for its removal
        healthCheck - the HealthCheck instance to be registered
        Returns:
        this instance for fluent registration
        Throws:
        IllegalStateException - if the HealthCheck instance cannot be registered
      • register

        default HealthRegistry register​(org.eclipse.microprofile.health.HealthCheck healthCheck)
        Programmatic registration of a HealthCheck intances with the id set to to the health check class name.
        Parameters:
        healthCheck - the HealthCheck instance to be registered
        Returns:
        this instance for fluent registration
        Throws:
        IllegalStateException - if the HealthCheck instance cannot be registered
      • remove

        HealthRegistry remove​(String id)
        Programmatic removal of a programmatically registered check (HealthCheck or AsyncHealthCheck) instances.
        Parameters:
        id - the id of the registered check to be removed
        Returns:
        this instance for fluent registration
        Throws:
        IllegalStateException - if the HealthCheck instance cannot be removed
      • remove

        default HealthRegistry remove​(org.eclipse.microprofile.health.HealthCheck healthCheck)
        Programmatic removal of a programmatically registered HealthCheck instances with the id set to the the health check class name.
        Parameters:
        healthCheck - the HealthCheck instance to be removed
        Returns:
        this instance for fluent registration
        Throws:
        IllegalStateException - if the HealthCheck instance cannot be removed