当前位置: 首页>>代码示例>>Java>>正文


Java JDBCClient.createNonShared方法代码示例

本文整理汇总了Java中io.vertx.ext.jdbc.JDBCClient.createNonShared方法的典型用法代码示例。如果您正苦于以下问题:Java JDBCClient.createNonShared方法的具体用法?Java JDBCClient.createNonShared怎么用?Java JDBCClient.createNonShared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.ext.jdbc.JDBCClient的用法示例。


在下文中一共展示了JDBCClient.createNonShared方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStockTradesPersisted

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Test
public void testStockTradesPersisted(TestContext context) throws ClassNotFoundException {
    Async async = context.async();
    JsonObject jdbcConfig = new JsonObject(config.getObject("jdbc").render(ConfigRenderOptions.concise()));
    JDBCClient jdbc = JDBCClient.createNonShared(vertx, jdbcConfig);
    Class.forName(jdbcConfig.getString("driverclass"));

    jdbc.getConnection(ar -> {
        SQLConnection connection = ar.result();
        if (ar.failed()) {
            context.fail(ar.cause());
        } else {
            connection.query(SELECT_STATEMENT, result -> {
                ResultSet set = result.result();
                List<JsonObject> operations = set.getRows().stream()
                        .map(json -> new JsonObject(json.getString("OPERATION")))
                        .collect(Collectors.toList());
                context.assertTrue(operations.size() >= 3);
                connection.close();
                async.complete();
            });
        }
    });
}
 
开发者ID:docker-production-aws,项目名称:microtrader,代码行数:25,代码来源:AuditVerticleTest.java

示例2: start

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Override
public void start(Future<Void> future) throws Exception {
  super.start();
  jdbcClient = JDBCClient.createNonShared(vertx.getDelegate(), config().getJsonObject("jdbc"));
  DatabaseService database = DatabaseService.create(vertx.getDelegate(), config());
  consumer = registerService(DatabaseService.class, vertx.getDelegate(), database, ADDRESS);
  startEBRouter(DatabaseService.ADDRESS, DatabaseService.class, future);
  // TODO: 3.09.2017 setup security for public users (getallusers should not be available for everyone)
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:10,代码来源:DatabaseVerticle.java

示例3: start

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
/**
 * Starts the verticle asynchronously. The the initialization is completed, it calls
 * `complete()` on the given {@link Future} object. If something wrong happens,
 * `fail` is called.
 *
 * @param future the future to indicate the completion
 */
@Override
public void start(Future<Void> future) throws ClassNotFoundException {
    super.start();

    // Get configuration
    config = ConfigFactory.load();

    // creates the jdbc client.
    JsonObject jdbcConfig = new JsonObject(config.getObject("jdbc").render(ConfigRenderOptions.concise()));
    jdbc = JDBCClient.createNonShared(vertx, jdbcConfig);
    Class.forName(jdbcConfig.getString("driverclass"));

    // Start HTTP server and listen for portfolio events
    EventBus eventBus = vertx.eventBus();
    Future<HttpServer> httpEndpointReady = configureTheHTTPServer();
    httpEndpointReady.setHandler(ar -> {
       if (ar.succeeded()) {
           MessageConsumer<JsonObject> portfolioConsumer = eventBus.consumer(config.getString("portfolio.address"));
           portfolioConsumer.handler(message -> {
               storeInDatabase(message.body());
           });
           future.complete();
       } else {
           future.fail(ar.cause());
       }
    });

    publishHttpEndpoint("audit", config.getString("http.host"), config.getInt("http.public.port"), config.getString("http.root"), ar -> {
        if (ar.failed()) {
            ar.cause().printStackTrace();
        } else {
            System.out.println("Audit (Rest endpoint) service published : " + ar.succeeded());
        }
    });
}
 
开发者ID:docker-production-aws,项目名称:microtrader,代码行数:43,代码来源:AuditVerticle.java

示例4: retrieve

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Override
public JDBCClient retrieve() {
  JsonObject result = record().getMetadata().copy();
  result.mergeIn(record().getLocation());

  if (config != null) {
    result.mergeIn(config);
  }

  if (result.getBoolean("shared", false)) {
    return JDBCClient.createShared(vertx, result);
  } else {
    return JDBCClient.createNonShared(vertx, result);
  }
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:16,代码来源:JDBCDataSourceImpl.java

示例5: continuingConnectionAttempts

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Test
public void continuingConnectionAttempts() {
  client = JDBCClient.createNonShared(vertx, config());
  vertx.setTimer(2000, res -> {
    testComplete();
  });
  client.getConnection(ar -> {
    fail("Should not get invoked");
  });
  await();
}
 
开发者ID:vert-x3,项目名称:vertx-jdbc-client,代码行数:12,代码来源:C3P0DataSourceProviderTest.java

示例6: stopConnectionAttempts

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Test
public void stopConnectionAttempts() {
  JsonObject config = config().put("acquire_retry_attempts", 1).put("break_after_acquire_failure", true);
  client = JDBCClient.createNonShared(vertx, config);
  vertx.setTimer(2000, res -> {
    fail("Should not get invoked");
  });
  client.getConnection(onFailure(t -> {
    assertThat(t, instanceOf(SQLException.class));
    testComplete();
  }));
  await();
}
 
开发者ID:vert-x3,项目名称:vertx-jdbc-client,代码行数:14,代码来源:C3P0DataSourceProviderTest.java

示例7: createProvider

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
@Override
public JDBCAuth createProvider(Vertx vertx) {
  JDBCClient client;
  if (shared) {
    if (datasourceName != null) {
      client = JDBCClient.createShared(vertx, config, datasourceName);
    } else {
      client = JDBCClient.createShared(vertx, config);
    }
  } else {
    client = JDBCClient.createNonShared(vertx, config);
  }
  JDBCAuth auth = JDBCAuth.create(vertx, client);
  if (authenticationQuery != null) {
    auth.setAuthenticationQuery(authenticationQuery);
  }
  if (rolesQuery != null) {
    auth.setRolesQuery(rolesQuery);
  }
  if (permissionsQuery != null) {
    auth.setPermissionsQuery(permissionsQuery);
  }
  if (rolesPrefix != null) {
    auth.setRolePrefix(rolesPrefix);
  }
  return auth;
}
 
开发者ID:vert-x3,项目名称:vertx-auth,代码行数:28,代码来源:JDBCAuthOptions.java

示例8: PaymentQueryServiceImpl

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
public PaymentQueryServiceImpl(Vertx vertx, JsonObject config) {
  this.jdbc = JDBCClient.createNonShared(vertx, config);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:4,代码来源:PaymentQueryServiceImpl.java

示例9: JdbcRepositoryWrapper

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
public JdbcRepositoryWrapper(Vertx vertx, JsonObject config) {
  this.client = JDBCClient.createNonShared(vertx, config);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:4,代码来源:JdbcRepositoryWrapper.java

示例10: createProvider

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
protected JDBCAuth createProvider() {
  JDBCClient client = JDBCClient.createNonShared(vertx, config());
  return JDBCAuth.create(vertx, client);
}
 
开发者ID:vert-x3,项目名称:vertx-auth,代码行数:5,代码来源:JDBCAuthTest.java

示例11: VertxJdbcClientImpl

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
public VertxJdbcClientImpl(Vertx vertx, JdbcOptionsBean config) {
    jdbcClient = JDBCClient.createNonShared(vertx, parseConfig(config));
}
 
开发者ID:apiman,项目名称:apiman,代码行数:4,代码来源:VertxJdbcClientImpl.java

示例12: exampleCreateNonShared

import io.vertx.ext.jdbc.JDBCClient; //导入方法依赖的package包/类
public void exampleCreateNonShared(Vertx vertx, JsonObject config) {

    SQLClient client = JDBCClient.createNonShared(vertx, config);

  }
 
开发者ID:vert-x3,项目名称:vertx-jdbc-client,代码行数:6,代码来源:JDBCExamples.java


注:本文中的io.vertx.ext.jdbc.JDBCClient.createNonShared方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。