@Override public ConsulClient healthStateWithOptions(HealthState healthState, CheckQueryOptions options, Handler<AsyncResult<CheckList>> resultHandler) { Query query = options == null ? null : Query.of("near", options.getNear()).put(options.getBlockingOptions()); requestArray(HttpMethod.GET, "/v1/health/state/" + healthState.key, query, null, resultHandler, (arr, headers) -> { List<Check> list = arr.stream().map(obj -> CheckParser.parse((JsonObject) obj)).collect(Collectors.toList()); return new CheckList().setList(list).setIndex(Long.parseLong(headers.get(INDEX_HEADER))); }); return this; }
@Override public ConsulClient healthChecksWithOptions(String service, CheckQueryOptions options, Handler<AsyncResult<CheckList>> resultHandler) { Query query = options == null ? null : Query.of("near", options.getNear()).put(options.getBlockingOptions()); requestArray(HttpMethod.GET, "/v1/health/checks/" + urlEncode(service), query, null, resultHandler, (arr, headers) -> { List<Check> list = arr.stream().map(obj -> CheckParser.parse((JsonObject) obj)).collect(Collectors.toList()); return new CheckList().setList(list).setIndex(Long.parseLong(headers.get(INDEX_HEADER))); }); return this; }