Interface HealthCheckHandler
- All Superinterfaces:
Handler<RoutingContext>
- 204 - status is `UP` but no procedures installed (no payload)
- 200 - status is `UP`, the payload contains the result of the installed procedures
- 503 - status is `DOWN`, the payload contains the result of the installed procedures
- 500 - status is `DOWN`, the payload contains the result of the installed procedures, one of the procedure has failed
- Author:
- Clement Escoffier
-
Method Summary
Modifier and TypeMethodDescriptionstatic HealthCheckHandlerCreates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlercreate(Vertx vertx, AuthenticationProvider provider) Creates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlerCreates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlercreateWithHealthChecks(HealthChecks hc, AuthenticationProvider provider) Creates an instance of the default implementation of theHealthCheckHandler.Registers a health check procedure.Registers a health check procedure.resultMapper(Function<CheckResult, Future<CheckResult>> resultMapper) Sets a function which will be invoked before theCheckResultgets written to clients.unregister(String name) Unregisters a procedure.
-
Method Details
-
create
Creates an instance of the default implementation of theHealthCheckHandler. This function creates a new instance ofHealthChecks.- Parameters:
vertx- the Vert.x instance, must not benullprovider- the Authentication provider used to authenticate the HTTP request- Returns:
- the created instance
-
create
Creates an instance of the default implementation of theHealthCheckHandler. This function creates a new instance ofHealthChecks.- Parameters:
vertx- the Vert.x instance, must not benull- Returns:
- the created instance
-
createWithHealthChecks
Creates an instance of the default implementation of theHealthCheckHandler.- Parameters:
hc- the health checks object to use, must not benull- Returns:
- the created instance
-
createWithHealthChecks
Creates an instance of the default implementation of theHealthCheckHandler.- Parameters:
hc- the health checks object to use- Returns:
- the created instance
-
register
Registers a health check procedure.The procedure is a
Handlertaking aPromiseofStatusas parameter. Procedures are asynchronous, and must complete or fail the givenPromise. If the future object is failed, the procedure outcome is considered as `DOWN`. If the future is completed without any object, the procedure outcome is considered as `UP`. If the future is completed with a (not-null)Status, the procedure outcome is the received status.This method uses a 1s timeout. To configure the timeout use
register(String, long, Handler).- Parameters:
name- the name of the procedure, must not benullor emptyprocedure- the procedure, must not benull- Returns:
- the current
HealthCheckHandler
-
register
Registers a health check procedure.The procedure is a
Handlertaking aPromiseofStatusas parameter. Procedures are asynchronous, and must complete or fail the givenPromise. If the future object is failed, the procedure outcome is considered as `DOWN`. If the future is completed without any object, the procedure outcome is considered as `UP`. If the future is completed with a (not-null)Status, the procedure outcome is the received status.- Parameters:
name- the name of the procedure, must not benullor emptytimeout- the procedure timeoutprocedure- the procedure, must not benull- Returns:
- the current
HealthCheckHandler
-
unregister
Unregisters a procedure.- Parameters:
name- the name of the procedure- Returns:
- the current
HealthCheckHandler
-
resultMapper
Sets a function which will be invoked before theCheckResultgets written to clients.- Parameters:
resultMapper- theFunctionused to manipulate theCheckResult,nullmeans no result mapper function enabled.- Returns:
- the current
HealthCheckHandler
-