Search in sources :

Example 1 with DBTest

use of ren.yale.java.bean.DBTest 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 {
                }
            });
        }
    });
}
Also used : DBTest(ren.yale.java.bean.DBTest) EventMessage(ren.yale.java.event.EventMessage) SQLConnection(io.vertx.ext.sql.SQLConnection) JsonObject(io.vertx.core.json.JsonObject) SummerSQL(ren.yale.java.sql.SummerSQL)

Aggregations

JsonObject (io.vertx.core.json.JsonObject)1 SQLConnection (io.vertx.ext.sql.SQLConnection)1 DBTest (ren.yale.java.bean.DBTest)1 EventMessage (ren.yale.java.event.EventMessage)1 SummerSQL (ren.yale.java.sql.SummerSQL)1