Search in sources :

Example 1 with Address

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

the class FutureWorker method sayHello.

@Address("ZERO://RPC/SECOND")
public Future<JsonObject> sayHello(final Envelop envelop) {
    final String name = Ux.getString(envelop);
    final JsonObject params = new JsonObject().put("name", name);
    return Ux.thenRpc("ipc-coeus", "RPC://SAY/FUTURE", params);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 2 with Address

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

the class SingleWorker method sayHello.

@Address("ZERO://RPC/FIRST")
public void sayHello(final Message<Envelop> message) {
    final String name = Ux.getString(message);
    final JsonObject params = new JsonObject().put("name", name);
    this.client.connect("ipc-coeus", "RPC://SAY/HELLO", params, res -> {
        if (res.succeeded()) {
            message.reply(Envelop.success(res.result()));
        } else {
            res.cause().printStackTrace();
            message.reply(Envelop.failure(res.cause().getMessage()));
        }
    });
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 3 with Address

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

the class TabularWorker method update.

@Address("ZERO://QUEUE/TABULAR/UPDATE")
Future<JsonObject> update(final Envelop envelop) {
    final Long id = Ux.getLong(envelop);
    final JsonObject data = Ux.getJson1(envelop);
    return this.stub.update(id, data);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 4 with Address

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

the class JavaStyleWorker method async.

@Address("ZERO://ASYNC/JAVA")
public Envelop async(final Envelop input) {
    final String literal = input.data();
    final JsonObject data = new JsonObject().put("result", "SUCCESS").put("input", literal);
    return Envelop.success(data);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Address(io.vertx.up.annotations.Address)

Example 5 with Address

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

the class VertxStyleWorker method sayMessage.

@Address("ZERO://ASYNC/VERTX/HANDLER")
public void sayMessage(final Message<Envelop> message) {
    final JsonObject data = Ux.getBody(message);
    message.reply(Envelop.success(data));
}
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