Class HealthCheckHandler
- java.lang.Object
-
- io.vertx.reactivex.ext.web.healthchecks.HealthCheckHandler
-
- All Implemented Interfaces:
Handler<RoutingContext>,RxDelegate
public class HealthCheckHandler extends Object implements RxDelegate, Handler<RoutingContext>
A Vert.x Web handler on which you register health check procedure. It computes the outcome status (`UP` or `DOWN`) . When the handler process an HTTP request, it computes the global outcome and build a HTTP response as follows:- 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
NOTE: This class has been automatically generated from the
originalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<HealthCheckHandler>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description HealthCheckHandler(HealthCheckHandler delegate)HealthCheckHandler(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HealthCheckHandlercreate(io.vertx.reactivex.core.Vertx vertx)Creates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlercreate(io.vertx.reactivex.core.Vertx vertx, AuthenticationProvider provider)Creates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlercreateWithHealthChecks(HealthChecks hc)Creates an instance of the default implementation of theHealthCheckHandler.static HealthCheckHandlercreateWithHealthChecks(HealthChecks hc, AuthenticationProvider provider)Creates an instance of the default implementation of theHealthCheckHandler.booleanequals(Object o)HealthCheckHandlergetDelegate()voidhandle(RoutingContext event)Something has happened, so handle it.inthashCode()static HealthCheckHandlernewInstance(HealthCheckHandler arg)HealthCheckHandlerregister(String name, long timeout, Handler<io.vertx.reactivex.core.Promise<Status>> procedure)Registers a health check procedure.HealthCheckHandlerregister(String name, Handler<io.vertx.reactivex.core.Promise<Status>> procedure)Registers a health check procedure.HealthCheckHandlerresultMapper(io.reactivex.functions.Function<CheckResult,io.reactivex.Single<CheckResult>> resultMapper)Sets a function which will be invoked before the gets written to clients.HealthCheckHandlerresultMapper(Function<CheckResult,Future<CheckResult>> resultMapper)Sets a function which will be invoked before the gets written to clients.StringtoString()HealthCheckHandlerunregister(String name)Unregisters a procedure.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HealthCheckHandler> __TYPE_ARG
-
-
Constructor Detail
-
HealthCheckHandler
public HealthCheckHandler(HealthCheckHandler delegate)
-
HealthCheckHandler
public HealthCheckHandler(Object delegate)
-
-
Method Detail
-
getDelegate
public HealthCheckHandler getDelegate()
- Specified by:
getDelegatein interfaceRxDelegate
-
handle
public void handle(RoutingContext event)
Something has happened, so handle it.- Specified by:
handlein interfaceHandler<RoutingContext>- Parameters:
event- the event to handle
-
create
public static HealthCheckHandler create(io.vertx.reactivex.core.Vertx vertx, AuthenticationProvider provider)
Creates an instance of the default implementation of theHealthCheckHandler. This function creates a new instance of .- Parameters:
vertx- the Vert.x instance, must not benullprovider- the Authentication provider used to authenticate the HTTP request- Returns:
- the created instance
-
create
public static HealthCheckHandler create(io.vertx.reactivex.core.Vertx vertx)
Creates an instance of the default implementation of theHealthCheckHandler. This function creates a new instance of .- Parameters:
vertx- the Vert.x instance, must not benull- Returns:
- the created instance
-
createWithHealthChecks
public static HealthCheckHandler createWithHealthChecks(HealthChecks hc, AuthenticationProvider provider)
Creates an instance of the default implementation of theHealthCheckHandler.- Parameters:
hc- the health checks object to use, must not benullprovider-- Returns:
- the created instance
-
createWithHealthChecks
public static HealthCheckHandler createWithHealthChecks(HealthChecks hc)
Creates an instance of the default implementation of theHealthCheckHandler.- Parameters:
hc- the health checks object to use- Returns:
- the created instance
-
register
public HealthCheckHandler register(String name, Handler<io.vertx.reactivex.core.Promise<Status>> procedure)
Registers a health check procedure.The procedure is a taking a of as parameter. Procedures are asynchronous, and must complete or fail the given . 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) , the procedure outcome is the received status.
This method uses a 1s timeout. To configure the timeout use
register(java.lang.String, io.vertx.core.Handler<io.vertx.reactivex.core.Promise<io.vertx.ext.healthchecks.Status>>).- Parameters:
name- the name of the procedure, must not benullor emptyprocedure- the procedure, must not benull- Returns:
- the current
HealthCheckHandler
-
register
public HealthCheckHandler register(String name, long timeout, Handler<io.vertx.reactivex.core.Promise<Status>> procedure)
Registers a health check procedure.The procedure is a taking a of as parameter. Procedures are asynchronous, and must complete or fail the given . 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) , 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
public HealthCheckHandler unregister(String name)
Unregisters a procedure.- Parameters:
name- the name of the procedure- Returns:
- the current
HealthCheckHandler
-
resultMapper
public HealthCheckHandler resultMapper(Function<CheckResult,Future<CheckResult>> resultMapper)
Sets a function which will be invoked before the gets written to clients.- Parameters:
resultMapper- the used to manipulate the ,nullmeans no result mapper function enabled.- Returns:
- the current
HealthCheckHandler
-
resultMapper
public HealthCheckHandler resultMapper(io.reactivex.functions.Function<CheckResult,io.reactivex.Single<CheckResult>> resultMapper)
Sets a function which will be invoked before the gets written to clients.- Parameters:
resultMapper- the used to manipulate the ,nullmeans no result mapper function enabled.- Returns:
- the current
HealthCheckHandler
-
newInstance
public static HealthCheckHandler newInstance(HealthCheckHandler arg)
-
-