/** * Publishes a record. * @param record the record * @param resultHandler handler called when the operation has completed (successfully or not). In case of success, the passed record has a registration id required to modify and un-register the service. */ public void publish(Record record, Handler<AsyncResult<Record>> resultHandler) { delegate.publish(record, resultHandler); }
/** * Publishes a record. * @param record the record * @param resultHandler handler called when the operation has completed (successfully or not). In case of success, the passed record has a registration id required to modify and un-register the service. */ public void publish(Record record, Handler<AsyncResult<Record>> resultHandler) { delegate.publish(record, resultHandler); }
/** * Registers the service and completes the given future when done. * * @param publisher the service publisher instance * @param completion the completion future * @return the current {@link ImportedConsulService} */ public ImportedConsulService register(ServicePublisher publisher, Future<ImportedConsulService> completion) { publisher.publish(record, ar -> { if (ar.succeeded()) { record.setRegistration(ar.result().getRegistration()); completion.complete(this); } else { completion.fail(ar.cause()); } }); return this; }
/** * Registers the service and completes the given future when done. * * @param publisher the service publisher instance * @param completion the completion future * @return the current {@link ImportedConsulService} */ public ImportedConsulService register(ServicePublisher publisher, Future<ImportedConsulService> completion) { publisher.publish(record, ar -> { if (ar.succeeded()) { record.setRegistration(ar.result().getRegistration()); completion.complete(this); } else { completion.fail(ar.cause()); } }); return this; }
public static void publish(io.vertx.servicediscovery.spi.ServicePublisher j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { j_receiver.publish(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record> ar) { resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null)); } } : null); } public static void update(io.vertx.servicediscovery.spi.ServicePublisher j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
private void publishRecord(Record record, Handler<AsyncResult<Record>> completionHandler) { publisher.publish(record, ar -> { if (completionHandler != null) { completionHandler.handle(ar); } if (ar.succeeded()) { LOGGER.info("Kubernetes service published in the vert.x service registry: " + record.toJson()); } else { LOGGER.error("Kubernetes service not published in the vert.x service registry", ar.cause()); } }); }
publisher.publish(record, ar -> { if (ar.succeeded()) { records.add(ar.result());
publisher.publish(record, ar -> { if (ar.succeeded()) { records.add(ar.result());
@Override public void start(Vertx vertx, ServicePublisher publisher, JsonObject configuration, Future<Void> future) { Record rec1 = HttpEndpoint.createRecord("static-record-1", "acme.org"); Record rec2 = HttpEndpoint.createRecord("static-record-2", "example.com"); publisher.publish(rec1, ar -> publisher.publish(rec2, ar2 -> { registered.set(true); future.complete(); })); }
@Override public void start(Vertx vertx, ServicePublisher publisher, JsonObject configuration, Future<Void> future) { Record rec1 = HttpEndpoint.createRecord("static-record-1", "acme.org"); Record rec2 = HttpEndpoint.createRecord("static-record-2", "example.com"); publisher.publish(rec1, ar -> publisher.publish(rec2, ar2 -> { registered.set(true); future.complete(); })); }
.map(instance -> { Future<Void> future = Future.future(); publisher.publish(createRecordForInstance(instance), v -> { if (v.succeeded()) { registrations.add(new RegistrationHolder<>(v.result(), instance));
.map(instance -> { Future<Void> future = Future.future(); publisher.publish(createRecordForInstance(instance), v -> { if (v.succeeded()) { registrations.add(new RegistrationHolder<>(v.result(), instance));
private void publish(DockerService service) { for (Record record : service.records()) { publisher.publish(record, ar -> { if (ar.succeeded()) { record.setRegistration(ar.result().getRegistration()); LOGGER.info("Service from container " + service.id() + " on location " + record.getLocation() + " has been published"); } else { LOGGER.error("Service from container " + service.id() + " on location " + record.getLocation() + " could not have been published", ar.cause()); } }); } }