List of usage examples for io.vertx.core Future failedFuture
static <T> Future<T> failedFuture(String failureMessage)
From source file:com.reachauto.device.DeviceServiceVertxEBProxy.java
License:Apache License
public DeviceService updateDevice(Device device, Handler<AsyncResult<Device>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w . j a v a 2 s . co m*/ JsonObject _json = new JsonObject(); _json.put("device", device == null ? null : device.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updateDevice"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future .succeededFuture(res.result().body() == null ? null : new Device(res.result().body()))); } }); return this; }
From source file:com.reachauto.device.DeviceServiceVertxEBProxy.java
License:Apache License
public DeviceService retrieveDevice(String id, Handler<AsyncResult<Device>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/* w w w . ja v a 2 s .c om*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveDevice"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future .succeededFuture(res.result().body() == null ? null : new Device(res.result().body()))); } }); return this; }
From source file:com.reachauto.product.ProductServiceVertxEBProxy.java
License:Apache License
public ProductService addProduct(Product product, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from ww w.ja v a 2 s . c o m*/ JsonObject _json = new JsonObject(); _json.put("product", product == null ? null : product.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "addProduct"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.reachauto.product.ProductServiceVertxEBProxy.java
License:Apache License
public ProductService deleteProduct(Integer id, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from www . j a v a 2 s . co m*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "deleteProduct"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.reachauto.product.ProductServiceVertxEBProxy.java
License:Apache License
public ProductService updateProduct(Product product, Handler<AsyncResult<Product>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w. ja va2s . c o m*/ JsonObject _json = new JsonObject(); _json.put("product", product == null ? null : product.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updateProduct"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future .succeededFuture(res.result().body() == null ? null : new Product(res.result().body()))); } }); return this; }
From source file:com.reachauto.product.ProductServiceVertxEBProxy.java
License:Apache License
public ProductService retrieveProduct(Integer id, Handler<AsyncResult<Product>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/* www. jav a 2 s. c om*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveProduct"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future .succeededFuture(res.result().body() == null ? null : new Product(res.result().body()))); } }); return this; }
From source file:com.test.db.DbServiceVertxEBProxy.java
License:Apache License
public void storedProc(String procName, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from w ww .j a v a2s . co m*/ } JsonObject _json = new JsonObject(); _json.put("procName", procName); _json.put("databaseConfig", databaseConfig); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "storedProc"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.test.db.DbServiceVertxEBProxy.java
License:Apache License
public void createStm(String query, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from w w w. ja v a 2 s . c o m*/ } JsonObject _json = new JsonObject(); _json.put("query", query); _json.put("databaseConfig", databaseConfig); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "createStm"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.test.db.DbServiceVertxEBProxy.java
License:Apache License
public void update(String query, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from ww w.ja v a2 s .c om } JsonObject _json = new JsonObject(); _json.put("query", query); _json.put("databaseConfig", databaseConfig); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "update"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.test.db.DbServiceVertxEBProxy.java
License:Apache License
public void delete(String query, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from w w w .jav a 2 s. co m } JsonObject _json = new JsonObject(); _json.put("query", query); _json.put("databaseConfig", databaseConfig); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "delete"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { resultHandler.handle(Future.failedFuture(res.cause())); } else { resultHandler.handle(Future.succeededFuture(res.result().body())); } }); }