List of usage examples for io.vertx.core Future failedFuture
static <T> Future<T> failedFuture(String failureMessage)
From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java
License:Apache License
public TaskService skip(Long taskId, String userId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w . j av a 2s.co m*/ JsonObject _json = new JsonObject(); _json.put("taskId", taskId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "skip"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java
License:Apache License
public TaskService start(Long taskId, String userId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w .j a va 2 s.c o m JsonObject _json = new JsonObject(); _json.put("taskId", taskId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "start"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java
License:Apache License
public TaskService stop(Long taskId, String userId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*w w w.j a v a 2 s . c o m*/ JsonObject _json = new JsonObject(); _json.put("taskId", taskId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "stop"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java
License:Apache License
public TaskService suspend(Long taskId, String userId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from ww w . j a va2s.c om JsonObject _json = new JsonObject(); _json.put("taskId", taskId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "suspend"); _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); return this; }
From source file:com.edgar.vertx.serviceproxy.provider.ProcessorServiceVertxEBProxy.java
License:Apache License
public void process(JsonObject document, Handler<AsyncResult<JsonObject>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;// w w w.j ava 2s . c om } JsonObject _json = new JsonObject(); _json.put("document", document); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "process"); _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.emikra.vertx.oak.OakServiceVertxEBProxy.java
License:Apache License
public void createNode(CreateNodeOptions options, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*w w w. j a v a 2 s . c o m*/ } JsonObject _json = new JsonObject(); _json.put("options", options == null ? null : options.toJson()); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createNode"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createDatabase(CreateDatabaseParams options, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//from w w w. j a v a 2 s .c om } JsonObject _json = new JsonObject(); _json.put("options", options == null ? null : options.toJson()); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createDatabase"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createDocument(JsonObject document, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/* w ww . jav a 2 s .c o m*/ } JsonObject _json = new JsonObject(); _json.put("document", document); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createDocument"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createVertex(JsonObject vertexDoc, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;//w w w . ja v a2 s .c om } JsonObject _json = new JsonObject(); _json.put("vertexDoc", vertexDoc); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createVertex"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }
From source file:com.emikra.vertx.orientdb.OrientDBServiceVertxEBProxy.java
License:Apache License
public void createEdge(JsonObject edgeDoc, Handler<AsyncResult<JsonObject>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return;/*w ww . j a v a 2 s .c o m*/ } JsonObject _json = new JsonObject(); _json.put("edgeDoc", edgeDoc); DeliveryOptions _deliveryOptions = new DeliveryOptions(); _deliveryOptions.addHeader("action", "createEdge"); _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture(res.result().body())); } }); }