Interface HealthCheckRegistry

All Superinterfaces:
AutoCloseable, CamelContextAware, HasId, IdAware, Service, StaticService

public interface HealthCheckRegistry extends CamelContextAware, StaticService, IdAware
A registry for health checks.
  • Field Details

  • Method Details

    • isEnabled

      boolean isEnabled()
      Whether Health Check is enabled globally
    • setEnabled

      void setEnabled(boolean enabled)
      Whether Health Check is enabled globally
    • resolveById

      Object resolveById(String id)
      Resolves HealthCheck or HealthCheckRepository by id. Will first lookup in this HealthCheckRegistry and then Registry, and lastly do classpath scanning via ServiceFactory. The classpath scanning is attempted first with id-health-check or id-health-check-repository as the key, and then with id as fallback if not found the first time.
      Returns:
      either HealthCheck or HealthCheckRepository, or null if none found.
    • register

      boolean register(Object obj)
    • unregister

      boolean unregister(Object obj)
    • getCheckIDs

      default Collection<String> getCheckIDs()
      A collection of health check IDs.
    • getCheck

      default Optional<HealthCheck> getCheck(String id)
      Returns the check identified by the given id if available.
    • getRepository

      Returns the repository identified by the given id if available.
    • get

      static HealthCheckRegistry get(CamelContext context)
      Returns an optional HealthCheckRegistry, by default no registry is present, and it must be explicit activated. Components can register/unregister health checks in response to life-cycle events (i.e. start/stop). This registry is not used by the camel context, but it is up to the implementation to properly use it, such as: - a RouteController could use the registry to decide to restart a route with failing health checks - spring boot could integrate such checks within its health endpoint or make it available only as separate endpoint.
    • stream

      Stream<HealthCheck> stream()
      Returns a sequential Stream with the known HealthCheck as its source.
    • loadHealthChecks

      void loadHealthChecks()
      Loads custom health checks by scanning classpath.
    • getExcludePattern

      String getExcludePattern()
      Pattern to exclude health checks from being invoked by Camel when checking healths. Multiple patterns can be separated by comma.
    • setExcludePattern

      void setExcludePattern(String excludePattern)
      Pattern to exclude health checks from being invoked by Camel when checking healths. Multiple patterns can be separated by comma.
    • isExcluded

      boolean isExcluded(HealthCheck healthCheck)
      Whether the given health check has been excluded
    • setExposureLevel

      void setExposureLevel(String exposureLevel)
      Sets the level of details to exposure as result of invoking health checks. There are the following levels: full, default, oneline The full level will include all details and status from all the invoked health checks. The default level will report UP if everything is okay, and only include detailed information for health checks that was DOWN. The oneline level will only report either UP or DOWN.
    • getExposureLevel

      String getExposureLevel()
      The exposure level
    • setInitialState

      void setInitialState(HealthCheck.State initialState)
      The initial state of health-checks (readiness). There are the following states: UP, DOWN, UNKNOWN. By default, the state is DOWN, is regarded as being pessimistic/careful. This means that the overall health checks may report as DOWN during startup and then only if everything is up and running flip to being UP. Setting the initial state to UP, is regarded as being optimistic. This means that the overall health checks may report as UP during startup and then if a consumer or other service is in fact un-healthy, then the health-checks can flip being DOWN. Setting the state to UNKNOWN means that some health-check would be reported in unknown state, especially during early bootstrap where a consumer may not be fully initialized or validated a connection to a remote system. This option allows to pre-configure the state for different modes.
    • getInitialState

      HealthCheck.State getInitialState()
      The initial state of health-checks.