/** * Create a proxy to a service that is deployed somewhere on the event bus * * @param vertx the Vert.x instance * @param address the address the service is listening on on the event bus * @return the service */ static ConsulService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(ConsulService.class, vertx, address); }
/** * Create a proxy to a service that is deployed somewhere on the event bus * * @param vertx the Vert.x instance * @param address the address the service is listening on on the event bus * @return the service */ static MongoService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(MongoService.class, vertx, address); }
/** * Factory method for creating a {@link JobService} service proxy. * This is useful for doing RPCs. * * @param vertx Vertx instance * @param address event bus address of RPC * @return the new {@link JobService} service proxy */ static JobService createProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(JobService.class, vertx, address); }
/** * create a proxy of MailService that delegates to the mail service running somewhere else via the event bus * * @param vertx the Vertx instance the proxy will be run in * @param address the eb address of the mail service running somewhere, default is "vertx.mail" * @return MailService instance that can then be used to send multiple mails */ static MailService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(MailService.class, vertx, address); }
/** * Create an event bus proxy to a service which lives somewhere on the network and is listening on the specified * event bus address * * @param vertx the Vert.x instance * @param address the address on the event bus where the service is listening * @return */ static AsyncSqlService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(AsyncSqlService.class, vertx, address); }
static HelloWorldServiceInterface createProxy(final Vertx vertx, final String address) { return ProxyHelper.createProxy(HelloWorldServiceInterface.class, vertx, address); }
/** * The method used to create proxy to consume the service. * * @param vertx vert.x * @param address the address where the service is served * @return the proxy */ static RecommendationService createProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(RecommendationService.class, vertx, address); }
/** * Method called to create a proxy (to consume the service). * * @param vertx vert.x * @param address the address on the vent bus where the service is served. * @return the proxy on the {@link DataStorageService} */ static DataStorageService createProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(DataStorageService.class, vertx, address); }
static ElasticSearchService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(ElasticSearchService.class, vertx, address); }
static ElasticSearchAdminService createEventBusProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(ElasticSearchAdminService.class, vertx, address); }
static Service createProxy(Vertx vertx, String address) { return ProxyHelper.createProxy(Service.class, vertx, address); }
/** * Creates a service proxy to the {@link Queryable} implementation * at the specified address. * <p> * The {@link DeliveryOptions} to use on the returned message consumer must be passed as * plain json, because it does not provide a toJson() method (see:vhttps://github.com/eclipse/vert.x/issues/1502). * * @param vertx the vert.x instance * @param address the address of the service proxy * @param deliveryOptions the delivery options to use on the message consumer * @return the graphql service proxy */ static Queryable createProxy(Vertx vertx, String address, JsonObject deliveryOptions) { return ProxyHelper.createProxy(Queryable.class, vertx, address, new DeliveryOptions(deliveryOptions)); }
public void getConnection(Handler<AsyncResult<SqlConnection>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return; } JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "getConnection"); _vertx.eventBus().<SqlConnection>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { String addr = res.result().headers().get("proxyaddr"); handler.handle(Future.succeededFuture(ProxyHelper.createProxy(SqlConnection.class, _vertx, addr))); } }); }
/** * * @param vertx * @param executor * @param serviceInterface * @param address */ ServiceProxyInvocationHandler(ServiceProxySupport serviceProxySupport, Class<?> serviceInterface, String address) { this.executor = serviceProxySupport.getExecutor(); DeliveryOptions deliveryOptions = serviceProxySupport.getDefaultDeliveryOptions(serviceInterface); if (deliveryOptions != null) { this.delegate = ProxyHelper.createProxy(serviceInterface, serviceProxySupport.getVertx(), address, deliveryOptions); } else { this.delegate = ProxyHelper.createProxy(serviceInterface, serviceProxySupport.getVertx(), address); } this.handlerParamPositionCache = new ConcurrentHashMap<>(); }
@Override public void createConnectionWithCloseFuture(Handler<AsyncResult<TestConnectionWithCloseFuture>> resultHandler){ if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return; } JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "createConnectionWithCloseFuture"); _vertx.eventBus().<TestConnectionWithCloseFuture>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { String addr = res.result().headers().get("proxyaddr"); resultHandler.handle(Future.succeededFuture(ProxyHelper.createProxy(TestConnectionWithCloseFuture.class, _vertx, addr))); } }); } @Override
@Override public void createConnection(String str, Handler<AsyncResult<TestConnection>> resultHandler){ if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return; } JsonObject _json = new JsonObject(); _json.put("str", str); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "createConnection"); _vertx.eventBus().<TestConnection>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { String addr = res.result().headers().get("proxyaddr"); resultHandler.handle(Future.succeededFuture(ProxyHelper.createProxy(TestConnection.class, _vertx, addr))); } }); } @Override
helloWorldServiceInterface = ProxyHelper.createProxy(HelloWorldServiceInterface.class, vertx, HELLO_WORLD_SERVICE);