List of usage examples for io.vertx.core.json JsonObject JsonObject
public JsonObject()
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 .j a va 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.tad.vertx.events.CDIEventBusBridge.java
License:Apache License
@Override public void onVertxStart() { EventBus eb = vertx.eventBus();//from www. j a v a 2 s .c o m eb.consumer("some-address", m -> beanManager.fireEvent(m.body())); vertx.setPeriodic(1000, v -> eb.publish("some-address", "Some text here " + v)); vertx.setPeriodic(1500, v -> eb.publish("some-address", new JsonObject().put("foo", "bar " + v))); }
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 w w . ja va2 s . c om } 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.j a v a 2s. com } 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 w w w .j a v 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", "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 ww .j a va 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())); } }); }
From source file:com.test.db.DbServiceVertxEBProxy.java
License:Apache License
public void read(String query, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from ww w.j a v a2s .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", "read"); _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 nonSharedRead(String query, JsonObject databaseConfig, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/* w w w .j a va2 s. com*/ } JsonObject _json = new JsonObject(); _json.put("query", query); _json.put("databaseConfig", databaseConfig); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "nonSharedRead"); _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.mailer.MailerServiceVertxEBProxy.java
License:Apache License
public void sendAttachment(String To, MailAttachment attachment, String Title, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*from w w w. ja va2 s .c o m*/ } JsonObject _json = new JsonObject(); _json.put("To", To); _json.put("attachment", attachment == null ? null : attachment.toJson()); _json.put("Title", Title); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "sendAttachment"); _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.themonkee.vertx.web.impl.MongoSessionStoreImpl.java
License:Open Source License
public MongoSessionStoreImpl(Vertx vertx, String mongoClientPoolName, JsonObject options, Future<MongoSessionStore> resultHandler) { this(vertx, MongoClient.createShared(vertx, new JsonObject(), mongoClientPoolName), options, resultHandler); }