List of usage examples for io.vertx.core Future succeededFuture
static <T> Future<T> succeededFuture(T result)
From source file:com.diabolicallabs.process.manager.service.KnowledgeServiceVertxEBProxy.java
License:Apache License
public KnowledgeService getTaskServiceAddress(Handler<AsyncResult<String>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w . jav a2s . c om JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "getTaskServiceAddress"); _vertx.eventBus().<String>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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService abort(Handler<AsyncResult<Void>> handler) { if (closed) { handler.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(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "abort"); _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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService start(Handler<AsyncResult<Long>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*ww w.ja v a 2 s .co m*/ JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "start"); _vertx.eventBus().<Long>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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService getInstanceId(Handler<AsyncResult<Long>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*w w w . ja va 2 s .c om*/ JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "getInstanceId"); _vertx.eventBus().<Long>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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService getName(Handler<AsyncResult<String>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from www . j av a2 s . co m JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "getName"); _vertx.eventBus().<String>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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService getParentInstanceId(Handler<AsyncResult<Long>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w . j a va 2s .c o m JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "getParentInstanceId"); _vertx.eventBus().<Long>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.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService getState(Handler<AsyncResult<ProcessState>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from w w w. java 2 s . co m JsonObject _json = new JsonObject(); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "getState"); _vertx.eventBus().<String>send(_address, _json, _deliveryOptions, res -> { if (res.failed()) { handler.handle(Future.failedFuture(res.cause())); } else { handler.handle(Future.succeededFuture( res.result().body() == null ? null : ProcessState.valueOf(res.result().body()))); } }); return this; }
From source file:com.diabolicallabs.process.manager.service.ProcessInstanceServiceVertxEBProxy.java
License:Apache License
public ProcessInstanceService signalEvent(String eventName, JsonObject data, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w .j a v a 2 s . c om*/ JsonObject _json = new JsonObject(); _json.put("eventName", eventName); _json.put("data", data); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "signalEvent"); _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.ProcessServiceVertxEBProxy.java
License:Apache License
public ProcessService abort(Long processInstanceId, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/* w ww .j av a 2 s .c o m*/ JsonObject _json = new JsonObject(); _json.put("processInstanceId", processInstanceId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "abort"); _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.ProcessServiceVertxEBProxy.java
License:Apache License
public ProcessService create(String processId, Handler<AsyncResult<ProcessInstanceService>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w.ja v a2s . c o m*/ JsonObject _json = new JsonObject(); _json.put("processId", processId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "create"); _vertx.eventBus().<ProcessInstanceService>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(ProcessInstanceService.class, _vertx, addr))); } }); return this; }