public static void start(io.vertx.servicediscovery.spi.ServiceImporter j_receiver, io.vertx.core.Vertx vertx, io.vertx.servicediscovery.spi.ServicePublisher publisher, java.util.Map<String, Object> configuration, io.vertx.core.Future<java.lang.Void> future) { j_receiver.start(vertx, publisher, configuration != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(configuration) : null, future); } }
@Override public ServiceDiscovery registerServiceImporter(ServiceImporter importer, JsonObject configuration, Handler<AsyncResult<Void>> completionHandler) { JsonObject conf; if (configuration == null) { conf = new JsonObject(); } else { conf = configuration; } Future<Void> completed = Future.future(); completed.setHandler( ar -> { if (ar.failed()) { LOGGER.error("Cannot start the service importer " + importer, ar.cause()); if (completionHandler != null) { completionHandler.handle(Future.failedFuture(ar.cause())); } } else { importers.add(importer); LOGGER.info("Service importer " + importer + " started"); if (completionHandler != null) { completionHandler.handle(Future.succeededFuture(null)); } } } ); importer.start(vertx, this, conf, completed); return this; }
@Override public ServiceDiscovery registerServiceImporter(ServiceImporter importer, JsonObject configuration, Handler<AsyncResult<Void>> completionHandler) { JsonObject conf; if (configuration == null) { conf = new JsonObject(); } else { conf = configuration; } Future<Void> completed = Future.future(); completed.setHandler( ar -> { if (ar.failed()) { LOGGER.error("Cannot start the service importer " + importer, ar.cause()); if (completionHandler != null) { completionHandler.handle(Future.failedFuture(ar.cause())); } } else { importers.add(importer); LOGGER.info("Service importer " + importer + " started"); if (completionHandler != null) { completionHandler.handle(Future.succeededFuture(null)); } } } ); importer.start(vertx, this, conf, completed); return this; }
/** * Starts the importer. * @param vertx the vertx instance * @param publisher the service publisher instance * @param configuration the bridge configuration if any * @param future a future on which the bridge must report the completion of the starting */ public void start(io.vertx.rxjava.core.Vertx vertx, io.vertx.rxjava.servicediscovery.spi.ServicePublisher publisher, JsonObject configuration, io.vertx.rxjava.core.Future<Void> future) { delegate.start(vertx.getDelegate(), publisher.getDelegate(), configuration, future.getDelegate()); }
public void initialize(Handler<ServiceDiscovery> completionHandler) { Collection<ServiceImporter> spi = getServiceImporterFromSPI(); Map<Future, ServiceImporter> map = new HashMap<>(); List<Future> futures = spi.stream().map(imp -> { Future<Void> fut = Future.future(); imp.start(vertx, this, new JsonObject(), fut); map.put(fut, imp); return fut; }).collect(Collectors.toList()); CompositeFuture.join(futures) .setHandler(ar -> { for (Future f : futures) { ServiceImporter serviceImporter = map.get(f); if (f.succeeded()) { LOGGER.info("Auto-registration of importer " + serviceImporter); importers.add(serviceImporter); } else { LOGGER.warn("Failed to register importer " + serviceImporter); } } completionHandler.handle(this); }); }
public void initialize(Handler<ServiceDiscovery> completionHandler) { Collection<ServiceImporter> spi = getServiceImporterFromSPI(); Map<Future, ServiceImporter> map = new HashMap<>(); List<Future> futures = spi.stream().map(imp -> { Future<Void> fut = Future.future(); imp.start(vertx, this, new JsonObject(), fut); map.put(fut, imp); return fut; }).collect(Collectors.toList()); CompositeFuture.join(futures) .setHandler(ar -> { for (Future f : futures) { ServiceImporter serviceImporter = map.get(f); if (f.succeeded()) { LOGGER.info("Auto-registration of importer " + serviceImporter); importers.add(serviceImporter); } else { LOGGER.warn("Failed to register importer " + serviceImporter); } } completionHandler.handle(this); }); }
/** * Starts the importer. * @param vertx the vertx instance * @param publisher the service publisher instance * @param configuration the bridge configuration if any * @param future a future on which the bridge must report the completion of the starting */ public void start(io.vertx.rxjava.core.Vertx vertx, io.vertx.rxjava.servicediscovery.spi.ServicePublisher publisher, JsonObject configuration, io.vertx.rxjava.core.Future<Void> future) { delegate.start(vertx.getDelegate(), publisher.getDelegate(), configuration, future.getDelegate()); }