use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.
the class DbWorker method sayDb.
@Address("ZERO://QUEUE/NATIVE/GET")
public void sayDb(final Message<Envelop> message) {
final String type = Ux.getString(message);
this.client.queryWithParams("SELECT * FROM SYS_TABULAR WHERE S_TYPE=?", new JsonArray().add(type), handler -> {
// Success or Failure
if (handler.succeeded()) {
final ResultSet res = handler.result();
// Build result json array
for (final JsonArray item : res.getResults()) {
System.out.println(item);
}
message.reply(Envelop.success(res.getResults()));
} else {
// Replied with error, now only print stack
handler.cause().printStackTrace();
message.reply(Envelop.ok());
}
});
}
use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.
the class SearchWorker method search.
@Address("ZERO://QUEUE/SEARCH")
public Future<JsonObject> search(final Envelop envelop) {
final JsonObject data = Ux.getJson(envelop);
System.out.println(data);
return this.searchStub.search(Ux.getInquiry(data, "tabular"));
}
use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.
the class SimpleWorker method sayHello.
@Address("EXP3://QUEUE/VALIDATE")
public void sayHello(final Message<Envelop> message) {
final JsonObject data = Ux.getJson(message);
Params.start(this.getClass()).monitor(data).end();
message.reply(Envelop.success("Response Successfully"));
}
use of io.vertx.up.annotations.Address in project vertx-zero by silentbalanceyh.
the class MongoWorker method sayMongo.
@Address("ZERO://QUEUE/NATIVE/MONGO")
public void sayMongo(final Message<Envelop> message) {
final JsonObject data = Ux.getJson(message);
this.client.insert("DB_TEST", data, res -> {
if (res.succeeded()) {
System.out.println(res.result());
message.reply(Ux.to(data));
} else {
res.cause().printStackTrace();
message.reply(Envelop.ok());
}
});
}
Aggregations