public interface HealthCheckRegistry extends CamelContextAware, StaticService, IdAware
Modifier and Type | Field and Description |
---|---|
static String |
FACTORY
Service factory key.
|
static String |
NAME
Service factory name.
|
Modifier and Type | Method and Description |
---|---|
static HealthCheckRegistry |
get(CamelContext context)
Returns an optional
HealthCheckRegistry , by default no registry is present, and it must be explicit
activated. |
default Optional<HealthCheck> |
getCheck(String id)
Returns the check identified by the given
id if available. |
default Collection<String> |
getCheckIDs()
A collection of health check IDs.
|
Optional<HealthCheckRepository> |
getRepository(String id)
Returns the repository identified by the given
id if available. |
boolean |
isEnabled()
Whether Health Check is enabled globally
|
void |
loadHealthChecks()
Loads custom health checks by scanning classpath.
|
boolean |
register(Object obj)
Registers a
HealthCheck or HealthCheckRepository . |
Object |
resolveById(String id)
Resolves
HealthCheck or HealthCheckRepository by id. |
void |
setEnabled(boolean enabled)
Whether Health Check is enabled globally
|
Stream<HealthCheck> |
stream()
Returns a sequential
Stream with the known HealthCheck as its source. |
boolean |
unregister(Object obj)
Unregisters a
HealthCheck or HealthCheckRepository . |
getCamelContext, setCamelContext, trySetCamelContext
setGeneratedId, setId
static final String NAME
static final String FACTORY
boolean isEnabled()
void setEnabled(boolean enabled)
Object resolveById(String id)
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.HealthCheck
or HealthCheckRepository
, or null if none found.boolean register(Object obj)
HealthCheck
or HealthCheckRepository
.boolean unregister(Object obj)
HealthCheck
or HealthCheckRepository
.default Collection<String> getCheckIDs()
default Optional<HealthCheck> getCheck(String id)
id
if available.Optional<HealthCheckRepository> getRepository(String id)
id
if available.static HealthCheckRegistry get(CamelContext context)
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<HealthCheck> stream()
Stream
with the known HealthCheck
as its source.void loadHealthChecks()
Apache Camel