/** * Lookups for a set of records. Unlike {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching * records. * @param filter the filter - see {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord} * @param resultHandler handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result. */ public void getRecords(JsonObject filter, Handler<AsyncResult<List<Record>>> resultHandler) { delegate.getRecords(filter, resultHandler); }
/** * {@inheritDoc} */ @Override public void getRecords(Function<Record, Boolean> filter, boolean includeOutOfService, Handler<AsyncResult<List<Record>>> resultHandler) { unmanagedDiscoveryInstance.getRecords(filter, includeOutOfService, resultHandler); }
/** * Lookups for a set of records. Unlike {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching * records. * @param filter the filter - see {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord} * @param resultHandler handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result. */ public void getRecords(JsonObject filter, Handler<AsyncResult<List<Record>>> resultHandler) { delegate.getRecords(filter, resultHandler); }
public static void getRecords(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.function.Function<java.util.Map<String, Object>, java.lang.Boolean> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) { j_receiver.getRecords(filter != null ? new java.util.function.Function<io.vertx.servicediscovery.Record, java.lang.Boolean>() { public java.lang.Boolean apply(io.vertx.servicediscovery.Record t) { java.util.Map<String, Object> o = t != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(t.toJson()) : null; java.lang.Boolean p = filter.apply(o); return p; } } : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.servicediscovery.Record>>>() { public void handle(io.vertx.core.AsyncResult<java.util.List<io.vertx.servicediscovery.Record>> ar) { resultHandler.handle(ar.map(event -> event != null ? event.stream().map(elt -> elt != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(elt.toJson()) : null).collect(java.util.stream.Collectors.toList()) : null)); } } : null); } public static void getRecords(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.function.Function<java.util.Map<String, Object>, java.lang.Boolean> filter, boolean includeOutOfService, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) {
/** * {@inheritDoc} */ @Override public void getRecords(JsonObject filter, Handler<AsyncResult<List<Record>>> resultHandler) { unmanagedDiscoveryInstance.getRecords(filter, resultHandler); }
/** * {@inheritDoc} */ @Override public void getRecords(Function<Record, Boolean> filter, Handler<AsyncResult<List<Record>>> resultHandler) { unmanagedDiscoveryInstance.getRecords(filter, resultHandler); }
/** * Lookups for a set of records. Unlike {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching * records. * <p> * The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it * as an <code>accept</code> method of a filter. This method return a record passing the filter. * <p> * This method only looks for records with a <code>UP</code> status. * @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records * @param resultHandler handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result. */ public void getRecords(Function<Record, Boolean> filter, Handler<AsyncResult<List<Record>>> resultHandler) { delegate.getRecords(filter, resultHandler); }
/** * Lookups for a set of records. Unlike {@link io.vertx.rxjava.servicediscovery.ServiceDiscovery#getRecord}, this method returns all matching * records. * <p> * The filter is a taking a {@link io.vertx.servicediscovery.Record} as argument and returning a boolean. You should see it * as an <code>accept</code> method of a filter. This method return a record passing the filter. * <p> * This method only looks for records with a <code>UP</code> status. * @param filter the filter, must not be <code>null</code>. To return all records, use a function accepting all records * @param resultHandler handler called when the lookup has been completed. When there are no matching record, the operation succeed, but the async result has an empty list as result. */ public void getRecords(Function<Record, Boolean> filter, Handler<AsyncResult<List<Record>>> resultHandler) { delegate.getRecords(filter, resultHandler); }
private void lookupAll(Function<Record, Boolean> filter, boolean includeOutOfService, Handler<AsyncResult<List<Record>>> handler) { if (isNull(filter)) throw new InvalidFilterException(); serviceDiscovery.getRecords(filter, includeOutOfService, handler); }
public static void getRecords(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) { j_receiver.getRecords(filter != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(filter) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.servicediscovery.Record>>>() { public void handle(io.vertx.core.AsyncResult<java.util.List<io.vertx.servicediscovery.Record>> ar) { resultHandler.handle(ar.map(event -> event != null ? event.stream().map(elt -> elt != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(elt.toJson()) : null).collect(java.util.stream.Collectors.toList()) : null)); } } : null); } public static void getRecords(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.function.Function<java.util.Map<String, Object>, java.lang.Boolean> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) {
private Future<List<Record>> getEndPoints() { final Future<List<Record>> future = Future.future(); this.discovery.getRecords(record -> record.getType().equals(HttpEndpoint.TYPE), future.completer()); return future; }
/** * Get all REST endpoints from the service discovery infrastructure. * * @return async result */ private Future<List<Record>> getAllEndpoints() { Future<List<Record>> future = Future.future(); discovery.getRecords(record -> record.getType().equals(HttpEndpoint.TYPE), future.completer()); return future; }
private Future<List<Record>> getEndPoints() { final Future<List<Record>> future = Future.future(); this.discovery.getRecords(record -> record.getType().equals(HttpEndpoint.TYPE), future.completer()); return future; }
private List<Record> getAllRecordsBlocking() { CountDownLatch latch = new CountDownLatch(1); List<Record> list = new ArrayList<>(); discovery.getRecords((JsonObject) null, ar -> { list.addAll(ar.result()); latch.countDown(); }); try { latch.await(); } catch (InterruptedException e) { // Ignore it. } return list; }
private List<Record> getRecordsBlocking(ServiceDiscovery discovery) { CountDownLatch latch = new CountDownLatch(1); List<Record> records = new ArrayList<>(); discovery.getRecords(s -> true, ar -> { records.addAll(ar.result()); latch.countDown(); }); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } return records; }
private List<Record> getAllRecordsBlocking() { CountDownLatch latch = new CountDownLatch(1); List<Record> list = new ArrayList<>(); discovery.getRecords((JsonObject) null, ar -> { list.addAll(ar.result()); latch.countDown(); }); try { latch.await(); } catch (InterruptedException e) { // Ignore it. } return list; }
private Future<List<Record>> serviceLookup(io.vertx.servicediscovery.ServiceDiscovery discovery, int expected) { Future<List<Record>> future = Future.future(); discovery.getRecords(x -> true, list -> { if (list.failed() || list.result().size() != expected) { future.fail("service lookup failed"); } else { future.complete(list.result()); } }); return future; }
private Future<List<Record>> serviceLookup(io.vertx.servicediscovery.ServiceDiscovery discovery, int expected) { Future<List<Record>> future = Future.future(); discovery.getRecords(x -> true, list -> { if (list.failed() || list.result().size() != expected) { future.fail("service lookup failed"); } else { future.complete(list.result()); } }); return future; }
private void fetchRecords(AtomicBoolean marker, TestContext tc) { sd.getRecords(x -> true, l -> { if (l.succeeded() && l.result().size() == 1) { tc.assertEquals("foo-service", l.result().get(0).getName()); marker.set(true); } else { vertx.setTimer(100, x -> fetchRecords(marker, tc)); } }); }
private void fetchRecords(AtomicBoolean marker, TestContext tc) { sd.getRecords(x -> true, l -> { if (l.succeeded() && l.result().size() == 1) { tc.assertEquals("foo-service", l.result().get(0).getName()); marker.set(true); } else { vertx.setTimer(100, x -> fetchRecords(marker, tc)); } }); }