use of ren.yale.java.event.EventMessage in project Summer by yale8848.
the class Hello method h3.
@GET
@Path("/async")
public void h3(@Context HttpServerResponse response, @Context Vertx vertx) {
vertx.eventBus().send("user", EventMessage.message("bob").setKey("name"), message -> {
EventMessage eventMessage = (EventMessage) message.result().body();
if (eventMessage.isSuccess()) {
String ret = String.format("name:%s,age:%d", eventMessage.getMessage(), 18);
response.end(ret);
} else {
response.end("error");
}
});
}
use of ren.yale.java.event.EventMessage in project Summer by yale8848.
the class TestService method test.
public SummerResponse test(Vertx vertx, RoutingContext routingContext) {
EventBus eb = vertx.eventBus();
EventMessage eventMessage = EventMessage.message(null);
eventMessage.setKey("68257");
return SummerResponse.fail().message("bbb");
}
use of ren.yale.java.event.EventMessage in project Summer by yale8848.
the class DXHResource method dxh.
@Path("/dxh/{dxhv}")
@GET
public void dxh(@PathParam("dxhv") String dxh, @Context Vertx vertx, @Context HttpServerResponse response) {
dxh = "8454005";
// WebClient client = WebClient.create(vertx);
// HttpUtils.oneDXH(client,response,dxh,vertx);
// response.end(dxh);
/* try {
EventBus eb = vertx.eventBus();
EventMessage eventMessage=EventMessage.message(null);
eventMessage.setKey("68257");
Message<EventMessage> reply = awaitResult(h -> eb.send("aaa", eventMessage, h));
//Message<EventMessage> reply1 = awaitResult(h -> eb.send("aaa", eventMessage, h));
response.end(reply.body().getMessage());
}catch (Exception e){
response.end(e.getMessage());
}*/
EventBus eb = vertx.eventBus();
EventMessage eventMessage = EventMessage.message(null);
eventMessage.setKey("68257");
// Message<EventMessage> reply = awaitResult(h -> eb.send("aaa", eventMessage, h));
// Message<EventMessage> reply1 = awaitResult(h -> eb.send("aaa", eventMessage, h));
// response.end(reply.body().getMessage());
}
use of ren.yale.java.event.EventMessage in project Summer by yale8848.
the class MyVerticle method start.
@Override
public void start() throws Exception {
vertx.eventBus().consumer("user", message -> {
EventMessage eventMessage = (EventMessage) message.body();
eventMessage.success(true);
eventMessage.setMessage("Hello " + eventMessage.getObject());
message.reply(eventMessage);
});
vertx.fileSystem().readFile("dev/dbt.json", bufferAsyncResult -> {
if (bufferAsyncResult.succeeded()) {
JsonObject jsonObject = bufferAsyncResult.result().toJsonObject().getJsonObject("reader");
jdbcReader = JDBCClient.createShared(vertx, jsonObject, "reader");
jdbcReader.getConnection(sqlConnectionAsyncResult -> {
if (sqlConnectionAsyncResult.succeeded()) {
LOGGER.info("+++++ db success");
SQLConnection sqlConnection = sqlConnectionAsyncResult.result();
sqlConnection.query(new SummerSQL().SELECT("*").FROM("db_test.tb_test").toString(), resultSetAsyncResult -> {
if (resultSetAsyncResult.succeeded()) {
List<DBTest> tests = ResultSetMapper.create().camelName().mapperList(resultSetAsyncResult.result(), DBTest.class);
}
sqlConnection.close();
});
} else {
}
});
}
});
}
Aggregations