/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.reactivex.ext.healthchecks;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.ext.healthchecks.Status;
import io.vertx.core.json.JsonObject;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.ext.healthchecks.HealthChecks original} non RX-ified interface using Vert.x codegen. */
@io.vertx.lang.rx.RxGen(io.vertx.ext.healthchecks.HealthChecks.class) public class HealthChecks { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthChecks that = (HealthChecks) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rx.TypeArg<HealthChecks> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new HealthChecks((io.vertx.ext.healthchecks.HealthChecks) obj), HealthChecks::getDelegate ); private final io.vertx.ext.healthchecks.HealthChecks delegate; public HealthChecks(io.vertx.ext.healthchecks.HealthChecks delegate) { this.delegate = delegate; } public io.vertx.ext.healthchecks.HealthChecks getDelegate() { return delegate; }
Creates a new instance of the default implementation of HealthChecks.
Params:
  • vertx – the instance of Vert.x, must not be null
Returns:the created instance
/** * Creates a new instance of the default implementation of {@link io.vertx.reactivex.ext.healthchecks.HealthChecks}. * @param vertx the instance of Vert.x, must not be <code>null</code> * @return the created instance */
public static io.vertx.reactivex.ext.healthchecks.HealthChecks create(io.vertx.reactivex.core.Vertx vertx) { io.vertx.reactivex.ext.healthchecks.HealthChecks ret = io.vertx.reactivex.ext.healthchecks.HealthChecks.newInstance(io.vertx.ext.healthchecks.HealthChecks.create(vertx.getDelegate())); return ret; }
Registers a health check procedure.

The procedure is a taking a of Status 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) Status, the procedure outcome is the received status.

This method uses a 1s timeout. Use register to configure the timeout.

Params:
  • name – the name of the procedure, must not be null or empty
  • procedure – the procedure, must not be null
Returns:the current HealthChecks
/** * Registers a health check procedure. * <p> * The procedure is a taking a of {@link io.vertx.ext.healthchecks.Status} as parameter. * Procedures are asynchronous, and <strong>must</strong> 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) {@link io.vertx.ext.healthchecks.Status}, the procedure outcome is the received status. * <p> * This method uses a 1s timeout. Use {@link io.vertx.reactivex.ext.healthchecks.HealthChecks#register} to configure the timeout. * @param name the name of the procedure, must not be <code>null</code> or empty * @param procedure the procedure, must not be <code>null</code> * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public io.vertx.reactivex.ext.healthchecks.HealthChecks register(String name, Handler<io.vertx.reactivex.core.Promise<Status>> procedure) { delegate.register(name, new Handler<io.vertx.core.Promise<io.vertx.ext.healthchecks.Status>>() { public void handle(io.vertx.core.Promise<io.vertx.ext.healthchecks.Status> event) { procedure.handle(io.vertx.reactivex.core.Promise.newInstance(event, io.vertx.lang.rx.TypeArg.unknown())); } }); return this; }
Registers a health check procedure.

The procedure is a taking a of Status 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) Status, the procedure outcome is the received status.

Params:
  • 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
/** * Registers a health check procedure. * <p> * The procedure is a taking a of {@link io.vertx.ext.healthchecks.Status} as parameter. * Procedures are asynchronous, and <strong>must</strong> 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) {@link io.vertx.ext.healthchecks.Status}, the procedure outcome is the received status. * @param name the name of the procedure, must not be <code>null</code> or empty * @param timeout the procedure timeout in milliseconds * @param procedure the procedure, must not be <code>null</code> * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public io.vertx.reactivex.ext.healthchecks.HealthChecks register(String name, long timeout, Handler<io.vertx.reactivex.core.Promise<Status>> procedure) { io.vertx.reactivex.ext.healthchecks.HealthChecks ret = io.vertx.reactivex.ext.healthchecks.HealthChecks.newInstance(delegate.register(name, timeout, new Handler<io.vertx.core.Promise<io.vertx.ext.healthchecks.Status>>() { public void handle(io.vertx.core.Promise<io.vertx.ext.healthchecks.Status> event) { procedure.handle(io.vertx.reactivex.core.Promise.newInstance(event, io.vertx.lang.rx.TypeArg.unknown())); } })); return ret; }
Unregisters a procedure.
Params:
  • name – the name of the procedure
Returns:the current HealthChecks
/** * Unregisters a procedure. * @param name the name of the procedure * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public io.vertx.reactivex.ext.healthchecks.HealthChecks unregister(String name) { delegate.unregister(name); return this; }
Invokes the registered procedures and computes the outcome.
Params:
  • resultHandler – the result handler, must not be null. The handler received the computed .
Returns:the current HealthChecks
/** * Invokes the registered procedures and computes the outcome. * @param resultHandler the result handler, must not be <code>null</code>. The handler received the computed . * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public io.vertx.reactivex.ext.healthchecks.HealthChecks invoke(Handler<JsonObject> resultHandler) { delegate.invoke(resultHandler); return this; }
Invokes the registered procedure with the given name and sub-procedures. It computes the overall outcome.
Params:
  • name –
  • resultHandler – the result handler, must not be null. The handler received an marked as failed if the procedure with the given name cannot be found or invoked.
Returns:the current HealthChecks
/** * Invokes the registered procedure with the given name and sub-procedures. It computes the overall * outcome. * @param name * @param resultHandler the result handler, must not be <code>null</code>. The handler received an marked as failed if the procedure with the given name cannot be found or invoked. * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public io.vertx.reactivex.ext.healthchecks.HealthChecks invoke(String name, Handler<AsyncResult<JsonObject>> resultHandler) { delegate.invoke(name, resultHandler); return this; }
Invokes the registered procedure with the given name and sub-procedures. It computes the overall outcome.
Params:
  • name –
Returns:the current HealthChecks
/** * Invokes the registered procedure with the given name and sub-procedures. It computes the overall * outcome. * @param name * @return the current {@link io.vertx.reactivex.ext.healthchecks.HealthChecks} */
public Single<JsonObject> rxInvoke(String name) { return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> { invoke(name, handler); }); } public static HealthChecks newInstance(io.vertx.ext.healthchecks.HealthChecks arg) { return arg != null ? new HealthChecks(arg) : null; } }