List of usage examples for io.vertx.core.json JsonObject JsonObject
public JsonObject()
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; }/*w w w. j a v a2 s.c o 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; }//from ww w . j a v a 2 s .c om 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 .j a v a 2s . c o 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 ww . ja v a 2s . com 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 w w .j a v 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; }// w w w . jav a 2 s.co 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; }
From source file:com.diabolicallabs.process.manager.service.ProcessServiceVertxEBProxy.java
License:Apache License
public ProcessService createWithVariables(String processId, JsonObject variables, Handler<AsyncResult<ProcessInstanceService>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w. j a va 2s . com*/ JsonObject _json = new JsonObject(); _json.put("processId", processId); _json.put("variables", variables); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "createWithVariables"); _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; }
From source file:com.diabolicallabs.process.manager.service.ProcessServiceVertxEBProxy.java
License:Apache License
public ProcessService signalEvent(String eventName, JsonObject data, 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("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 signalEventForProcess(String eventName, Long processInstanceId, JsonObject data, Handler<AsyncResult<Void>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w. j a v a2 s .co m JsonObject _json = new JsonObject(); _json.put("eventName", eventName); _json.put("processInstanceId", processInstanceId); _json.put("data", data); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "signalEventForProcess"); _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 startProcess(String processId, Handler<AsyncResult<ProcessInstanceService>> handler) { if (closed) { handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from ww w .j a v a2s .co m JsonObject _json = new JsonObject(); _json.put("processId", processId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "startProcess"); _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; }