Search in sources :

Example 6 with Address

use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.

the class AsyncWorker method reply.

@Address("ZERO://EVENT")
public Envelop reply(final Envelop envelop) {
    final JsonObject resource = envelop.data();
    System.out.println(resource);
    resource.put("result", "SUCCESS");
    return Envelop.success(resource);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 7 with Address

use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.

the class FacadeWorker method testFacade.

@Address("ZERO://FACADE/STYLE")
public Future<JsonObject> testFacade(final Envelop envelop) {
    final String arg0 = Ux.getString(envelop);
    final String arg1 = Ux.getString1(envelop);
    return Future.succeededFuture(new JsonObject().put("style", arg0).put("mode", arg1));
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 8 with Address

use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.

the class FilterWorker method work.

@Address("ZERO://JSR340/WORKER")
public Future<JsonObject> work(final Envelop envelop) {
    final String key = envelop.context("key", String.class);
    final String key1 = envelop.context("key1", String.class);
    return Future.succeededFuture(new JsonObject().put("key", key).put("key1", key1));
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 9 with Address

use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.

the class FetchListWorker method fetchByMulti.

@Address("ZERO://QUEUE/LIST/BY/MULTI")
public Future<JsonArray> fetchByMulti(final Envelop envelop) {
    final String type = Ux.getString(envelop);
    final String code = Ux.getString1(envelop);
    final JsonObject filters = new JsonObject();
    filters.put("S_TYPE", type).put("S_CODE", code);
    return this.stub.fetchByFilters(filters);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 10 with Address

use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.

the class MultiWorker method sayHello.

@Address("ZERO://RPC/MULTI")
@SuppressWarnings("unchecked")
public Future<JsonObject> sayHello(final Envelop envelop) {
    final String name = Ux.getString(envelop);
    final JsonObject params = new JsonObject().put("name", name);
    return Ux.thenParallelJson(Ux.thenRpc("ipc-crius", "RPC://SAY/MULTI", params), Ux.thenRpc("ipc-coeus", "RPC://SAY/MULTI", params)).compose(item -> {
        final JsonObject crius = item.getJsonObject("0");
        final JsonObject coeus = item.getJsonObject("1");
        return Future.succeededFuture(new JsonObject().put("name", crius.getValue("name")).put("first", crius.getValue("service")).put("second", coeus.getValue("service")));
    });
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Aggregations

Address (io.vertx.up.annotations.Address)14 JsonObject (io.vertx.core.json.JsonObject)13 JsonArray (io.vertx.core.json.JsonArray)1 ResultSet (io.vertx.ext.sql.ResultSet)1