public static io.vertx.ext.consul.ConsulService healthStateWithOptions(io.vertx.ext.consul.ConsulService j_receiver, io.vertx.ext.consul.HealthState healthState, java.util.Map<String, Object> checkQueryOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.healthStateWithOptions(healthState, checkQueryOptions != null ? new io.vertx.ext.consul.CheckQueryOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(checkQueryOptions)) : null, handler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList> ar) { handler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.consul.ConsulService healthServiceNodes(io.vertx.ext.consul.ConsulService j_receiver, java.lang.String service, boolean passing, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.consul.ConsulService healthChecksWithOptions(io.vertx.ext.consul.ConsulService j_receiver, java.lang.String service, java.util.Map<String, Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.healthChecksWithOptions(service, options != null ? new io.vertx.ext.consul.CheckQueryOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList> ar) { resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.consul.ConsulService healthState(io.vertx.ext.consul.ConsulService j_receiver, io.vertx.ext.consul.HealthState healthState, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> handler) {
public static io.vertx.ext.consul.ConsulClient healthStateWithOptions(io.vertx.ext.consul.ConsulClient j_receiver, io.vertx.ext.consul.HealthState healthState, java.util.Map<String, Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.healthStateWithOptions(healthState, options != null ? new io.vertx.ext.consul.CheckQueryOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList> ar) { resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.consul.ConsulClient healthServiceNodes(io.vertx.ext.consul.ConsulClient j_receiver, java.lang.String service, boolean passing, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.consul.ConsulClient healthChecksWithOptions(io.vertx.ext.consul.ConsulClient j_receiver, java.lang.String service, java.util.Map<String, Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.healthChecksWithOptions(service, options != null ? new io.vertx.ext.consul.CheckQueryOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.CheckList> ar) { resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.consul.ConsulClient healthState(io.vertx.ext.consul.ConsulClient j_receiver, io.vertx.ext.consul.HealthState healthState, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
@Test public void healthState() throws InterruptedException { String serviceName = randomAlphaString(10); ServiceOptions opts = new ServiceOptions() .setName(serviceName) .setId(serviceName) .setCheckOptions(new CheckOptions().setTtl("1m")); runAsync(h -> ctx.writeClient().registerService(opts, h)); CheckList list1 = getAsync(h -> ctx.readClient().healthState(HealthState.CRITICAL, h)); CountDownLatch latch = new CountDownLatch(1); waitBlockingQuery(latch, 10, list1.getIndex(), (idx, fut) -> { CheckQueryOptions options = new CheckQueryOptions() .setBlockingOptions(new BlockingQueryOptions().setIndex(idx)); ctx.readClient().healthStateWithOptions(HealthState.PASSING, options, h -> { List<String> names = h.result().getList().stream().map(Check::getServiceName).collect(Collectors.toList()); waitComplete(vertx, fut, h.result().getIndex(), names.contains(serviceName)); }); }); runAsync(h -> ctx.writeClient().passCheck("service:" + serviceName, h)); awaitLatch(latch); runAsync(h -> ctx.writeClient().deregisterService(serviceName, h)); }
CheckQueryOptions options = new CheckQueryOptions() .setBlockingOptions(new BlockingQueryOptions().setIndex(idx)); ctx.readClient().healthChecksWithOptions("serviceName", options, h -> {