Class AbstractHealthIndicator<T>

java.lang.Object
io.micronaut.management.health.indicator.AbstractHealthIndicator<T>
Type Parameters:
T - The health indication type
All Implemented Interfaces:
Ordered, HealthIndicator
Direct Known Subclasses:
DiskSpaceIndicator

public abstract class AbstractHealthIndicator<T> extends Object implements HealthIndicator

A base health indicator class to extend from that catches exceptions thrown from the getHealthInformation() method and updates the HealthResult with the exception information.

Since:
1.0
Author:
James Kleeh
  • Field Details

  • Constructor Details

    • AbstractHealthIndicator

      public AbstractHealthIndicator()
  • Method Details

    • setExecutorService

      @Inject public void setExecutorService(@Named("blocking") ExecutorService executorService)
      Parameters:
      executorService - The executor service
    • getResult

      public Publisher<HealthResult> getResult()
      Specified by:
      getResult in interface HealthIndicator
      Returns:
      A publisher that returns a HealthResult that provides the information necessary to build a response.
    • getHealthInformation

      protected abstract T getHealthInformation()
      Provides information (typically a Map) to be returned. Set the healthStatus field during execution, otherwise HealthStatus.UNKNOWN will be used.
      Returns:
      Any details to be included in the response.
    • getHealthResult

      protected HealthResult getHealthResult()
      Builds the whole health result.
      Returns:
      The health result to provide to the indicator.
    • getName

      protected abstract String getName()
      Used to populate the HealthResult. Provides a key to go along with the health information.
      Returns:
      The name of the indicator