public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, EventListOptions obj) { for (java.util.Map.Entry<String, Object> member : json) { switch (member.getKey()) { case "blockingOptions": if (member.getValue() instanceof JsonObject) { obj.setBlockingOptions(new io.vertx.ext.consul.BlockingQueryOptions((JsonObject)member.getValue())); } break; case "name": if (member.getValue() instanceof String) { obj.setName((String)member.getValue()); } break; } } }
public static void toJson(EventListOptions obj, java.util.Map<String, Object> json) { if (obj.getBlockingOptions() != null) { json.put("blockingOptions", obj.getBlockingOptions().toJson()); } if (obj.getName() != null) { json.put("name", obj.getName()); } } }
@Override void wait(long index, Handler<AsyncResult<State<EventList>>> handler) { BlockingQueryOptions bOpts = new BlockingQueryOptions().setWait(BLOCKING_WAIT).setIndex(index); EventListOptions eOpts = new EventListOptions().setBlockingOptions(bOpts).setName(event); consulClient.listEventsWithOptions(eOpts, h -> handler.handle(h.map(events -> new State<EventList>(events, events.getIndex())))); } }
public static io.vertx.ext.consul.ConsulService listEventsWithOptions(io.vertx.ext.consul.ConsulService j_receiver, 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.listEventsWithOptions(options != null ? new io.vertx.ext.consul.EventListOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.EventList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.EventList> 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 registerService(io.vertx.ext.consul.ConsulService j_receiver, java.util.Map<String, Object> serviceOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler) {
.count(); tc.assertEquals(cnt1, (long) 1); ctx.writeClient().listEventsWithOptions(new EventListOptions().setName(name2), tc.asyncAssertSuccess(list2 -> { tc.assertEquals(list2.getList().size(), 0); Async async = tc.async(2); blockingQueryOptions.setWait("2s"); ctx.writeClient().listEventsWithOptions(new EventListOptions().setBlockingOptions(blockingQueryOptions), tc.asyncAssertSuccess(h -> { List<String> names = h.getList().stream().map(Event::getName).collect(Collectors.toList()); if (timeout) { tc.assertEquals(async.count(), timeout ? 1 : 2); ctx.writeClient().fireEvent(name2, tc.asyncAssertSuccess(ev -> { ctx.writeClient().listEventsWithOptions(new EventListOptions().setName(name2), tc.asyncAssertSuccess(list3 -> { tc.assertEquals(list3.getList().size(), 1); async.complete();
public static io.vertx.ext.consul.ConsulClient listEventsWithOptions(io.vertx.ext.consul.ConsulClient j_receiver, 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.listEventsWithOptions(options != null ? new io.vertx.ext.consul.EventListOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.consul.EventList>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.ext.consul.EventList> 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 registerService(io.vertx.ext.consul.ConsulClient j_receiver, java.util.Map<String, Object> serviceOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler) {
@Override public ConsulClient listEventsWithOptions(EventListOptions options, Handler<AsyncResult<EventList>> resultHandler) { Query query = options == null ? null : Query.of(options.getBlockingOptions()).put("name", options.getName()); requestArray(HttpMethod.GET, "/v1/event/list", query, null, resultHandler, (jsonArray, headers) -> { List<Event> list = jsonArray.stream().map(obj -> EventParser.parse(((JsonObject) obj))).collect(Collectors.toList()); return new EventList().setList(list).setIndex(Long.parseUnsignedLong(headers.get(INDEX_HEADER))); }); return this; }