Interface HealthChecks

    • Method Detail

      • create

        static HealthChecks create​(Vertx vertx)
        Creates a new instance of the default implementation of HealthChecks.
        Parameters:
        vertx - the instance of Vert.x, must not be null
        Returns:
        the created instance
      • register

        HealthChecks register​(String name,
                              Handler<Promise<Status>> procedure)
        Registers a health check procedure.

        The procedure is a Handler taking a Promise of Status as parameter. Procedures are asynchronous, and must complete or fail the given Promise. 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. Use register(String, long, Handler) to configure the timeout.

        Parameters:
        name - the name of the procedure, must not be null or empty
        procedure - the procedure, must not be null
        Returns:
        the current HealthChecks
      • register

        HealthChecks register​(String name,
                              long timeout,
                              Handler<Promise<Status>> procedure)
        Registers a health check procedure.

        The procedure is a Handler taking a Promise of Status as parameter. Procedures are asynchronous, and must complete or fail the given Promise. 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 be null or empty
        timeout - the procedure timeout in milliseconds
        procedure - the procedure, must not be null
        Returns:
        the current HealthChecks
      • unregister

        HealthChecks unregister​(String name)
        Unregisters a procedure.
        Parameters:
        name - the name of the procedure
        Returns:
        the current HealthChecks
      • invoke

        HealthChecks invoke​(Handler<JsonObject> resultHandler)
        Invokes the registered procedures and computes the outcome.
        Parameters:
        resultHandler - the result handler, must not be null. The handler received the computed JsonObject.
        Returns:
        the current HealthChecks
      • invoke

        Future<JsonObject> invoke​(String name)
        Invokes the registered procedure with the given name and sub-procedures. It computes the overall outcome.
        Returns:
        a future notified with a failure if the procedure with the given name cannot be found or invoked.
      • checkStatus

        Future<CheckResult> checkStatus()
        Invokes the registered procedures.
        Returns:
        a future notified with the computed CheckResult.
      • checkStatus

        Future<CheckResult> checkStatus​(String name)
        Invokes the registered procedure with the given name and sub-procedures.
        Returns:
        a future notified with a failure if the procedure with the given name cannot be found or invoked.