Package org.apache.camel.health
Interface HealthCheckRegistry
-
- All Superinterfaces:
AutoCloseable
,CamelContextAware
,HasId
,IdAware
,Service
,StaticService
public interface HealthCheckRegistry extends CamelContextAware, StaticService, IdAware
A registry for health checks.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static HealthCheckRegistry
get(CamelContext context)
Returns an optionalHealthCheckRegistry
, by default no registry is present, and it must be explicit activated.default Optional<HealthCheck>
getCheck(String id)
Returns the check identified by the givenid
if available.default Collection<String>
getCheckIDs()
A collection of health check IDs.Optional<HealthCheckRepository>
getRepository(String id)
Returns the repository identified by the givenid
if available.boolean
isEnabled()
Whether Health Check is enabled globallyvoid
loadHealthChecks()
Loads custom health checks by scanning classpath.boolean
register(Object obj)
Registers aHealthCheck
orHealthCheckRepository
.Object
resolveById(String id)
ResolvesHealthCheck
orHealthCheckRepository
by id.void
setEnabled(boolean enabled)
Whether Health Check is enabled globallyStream<HealthCheck>
stream()
Returns a sequentialStream
with the knownHealthCheck
as its source.boolean
unregister(Object obj)
Unregisters aHealthCheck
orHealthCheckRepository
.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
Methods inherited from interface org.apache.camel.spi.IdAware
setGeneratedId, setId
-
-
-
-
Field Detail
-
NAME
static final String NAME
Service factory name.- See Also:
- Constant Field Values
-
FACTORY
static final String FACTORY
Service factory key.- See Also:
- Constant Field Values
-
-
Method Detail
-
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)
ResolvesHealthCheck
orHealthCheckRepository
by id. Will first lookup in thisHealthCheckRegistry
and thenRegistry
, and lastly do classpath scanning viaServiceFactory
. 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
orHealthCheckRepository
, or null if none found.
-
register
boolean register(Object obj)
Registers aHealthCheck
orHealthCheckRepository
.
-
unregister
boolean unregister(Object obj)
Unregisters aHealthCheck
orHealthCheckRepository
.
-
getCheckIDs
default Collection<String> getCheckIDs()
A collection of health check IDs.
-
getCheck
default Optional<HealthCheck> getCheck(String id)
Returns the check identified by the givenid
if available.
-
getRepository
Optional<HealthCheckRepository> getRepository(String id)
Returns the repository identified by the givenid
if available.
-
get
static HealthCheckRegistry get(CamelContext context)
Returns an optionalHealthCheckRegistry
, 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 sequentialStream
with the knownHealthCheck
as its source.
-
loadHealthChecks
void loadHealthChecks()
Loads custom health checks by scanning classpath.
-
-