Java Code Examples for io.vertx.pgclient.PgPool#pool()
The following examples show how to use
io.vertx.pgclient.PgPool#pool() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PgPoolRecorder.java From quarkus with Apache License 2.0 | 5 votes |
private PgPool initialize(Vertx vertx, DataSourceRuntimeConfig dataSourceRuntimeConfig, DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig, DataSourceReactivePostgreSQLConfig dataSourceReactivePostgreSQLConfig) { PoolOptions poolOptions = toPoolOptions(dataSourceRuntimeConfig, dataSourceReactiveRuntimeConfig, dataSourceReactivePostgreSQLConfig); PgConnectOptions pgConnectOptions = toPgConnectOptions(dataSourceRuntimeConfig, dataSourceReactiveRuntimeConfig, dataSourceReactivePostgreSQLConfig); if (dataSourceReactiveRuntimeConfig.threadLocal.isPresent() && dataSourceReactiveRuntimeConfig.threadLocal.get()) { return new ThreadLocalPgPool(vertx, pgConnectOptions, poolOptions); } return PgPool.pool(vertx, pgConnectOptions, poolOptions); }
Example 2
Source File: PgPoolRecorder.java From quarkus with Apache License 2.0 | 5 votes |
private PgPool legacyInitialize(Vertx vertx, DataSourceRuntimeConfig dataSourceRuntimeConfig, LegacyDataSourceRuntimeConfig legacyDataSourceRuntimeConfig, LegacyDataSourceReactivePostgreSQLConfig legacyDataSourceReactivePostgreSQLConfig) { PoolOptions poolOptions = legacyToPoolOptionsLegacy(legacyDataSourceRuntimeConfig); PgConnectOptions pgConnectOptions = legacyToPostgreSQLConnectOptions(dataSourceRuntimeConfig, legacyDataSourceRuntimeConfig, legacyDataSourceReactivePostgreSQLConfig); return PgPool.pool(vertx, pgConnectOptions, poolOptions); }
Example 3
Source File: PostgresClient.java From raml-module-builder with Apache License 2.0 | 5 votes |
static PgPool createPgPool(Vertx vertx, JsonObject configuration) { PgConnectOptions connectOptions = createPgConnectOptions(configuration); PoolOptions poolOptions = new PoolOptions(); poolOptions.setMaxSize(configuration.getInteger(MAX_POOL_SIZE, 4)); return PgPool.pool(vertx, connectOptions, poolOptions); }
Example 4
Source File: App.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 5 votes |
public PgClientBenchmark(Vertx vertx, JsonObject config) { PgConnectOptions options = new PgConnectOptions() .setCachePreparedStatements(true) .setHost(config.getString("host")) .setPort(config.getInteger("port", 5432)) .setUser(config.getString("username")) .setPassword(config.getString("password")) .setDatabase(config.getString("database")); client = PgPool.pool(vertx, options, new PoolOptions().setMaxSize(4)); this.engine = RockerTemplateEngine.create(); }
Example 5
Source File: ThreadLocalPgPool.java From quarkus with Apache License 2.0 | 4 votes |
@Override protected PgPool createThreadLocalPool() { return PgPool.pool(vertx, pgConnectOptions, poolOptions); }
Example 6
Source File: PgDriver.java From vertx-sql-client with Apache License 2.0 | 4 votes |
@Override public Pool createPool(SqlConnectOptions options, PoolOptions poolOptions) { return PgPool.pool(wrap(options), poolOptions); }
Example 7
Source File: PgDriver.java From vertx-sql-client with Apache License 2.0 | 4 votes |
@Override public Pool createPool(Vertx vertx, SqlConnectOptions options, PoolOptions poolOptions) { return PgPool.pool(vertx, wrap(options), poolOptions); }
Example 8
Source File: PgTransactionTest.java From vertx-sql-client with Apache License 2.0 | 4 votes |
@Override protected Pool createPool() { return PgPool.pool(vertx, new PgConnectOptions(rule.options()), new PoolOptions().setMaxSize(1)); }
Example 9
Source File: PgTransactionTest.java From vertx-sql-client with Apache License 2.0 | 4 votes |
@Override protected Pool nonTxPool() { return PgPool.pool(vertx, new PgConnectOptions(rule.options()), new PoolOptions().setMaxSize(1)); }
Example 10
Source File: PgTracingTest.java From vertx-sql-client with Apache License 2.0 | 4 votes |
@Override protected Pool createPool(Vertx vertx) { return PgPool.pool(vertx, rule.options(), new PoolOptions()); }
Example 11
Source File: PostgresHandle.java From okapi with Apache License 2.0 | 4 votes |
PostgresHandle(Vertx vertx, JsonObject conf) { String val; connectOptions = new PgConnectOptions(); val = Config.getSysConf("postgres_host", null, conf); if (val != null) { connectOptions.setHost(val); } val = Config.getSysConf("postgres_port", null, conf); Logger logger = OkapiLogger.get(); if (val != null) { try { connectOptions.setPort(Integer.parseInt(val)); } catch (NumberFormatException e) { logger.warn("Bad postgres_port value: {}: {}", val, e.getMessage()); } } // postgres_user is supported for system configuration (-D option) only and is deprecated connectOptions.setUser(Config.getSysConf("postgres_username", Config.getSysConf("postgres_user", "okapi", new JsonObject()), conf)); connectOptions.setPassword(Config.getSysConf("postgres_password", "okapi25", conf)); connectOptions.setDatabase(Config.getSysConf("postgres_database", "okapi", conf)); String serverPem = Config.getSysConf("postgres_server_pem", null, conf); if (serverPem != null) { logger.debug("Enforcing SSL encryption for PostgreSQL connections, " + "requiring TLSv1.3 with server name certificate"); connectOptions.setSslMode(SslMode.VERIFY_FULL); connectOptions.setHostnameVerificationAlgorithm("HTTPS"); connectOptions.setPemTrustOptions( new PemTrustOptions().addCertValue(Buffer.buffer(serverPem))); connectOptions.setEnabledSecureTransportProtocols(Collections.singleton("TLSv1.3")); connectOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions()); } PoolOptions poolOptions = new PoolOptions(); poolOptions.setMaxSize(5); pool = PgPool.pool(vertx, connectOptions, poolOptions); logger.debug("created"); }
Example 12
Source File: ReactiveDatabaseClientProvider.java From vertx-jooq with MIT License | 4 votes |
private ReactiveDatabaseClientProvider() { this.vertx = Vertx.vertx(); this.pgClient = PgPool.pool(vertx, getOptions(), new PoolOptions()); this.rxPgClient = new io.vertx.reactivex.sqlclient.Pool(pgClient); }
Example 13
Source File: PoolManager.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 4 votes |
public PgPool pool() { if (null==pool) { pool = PgPool.pool(vertx, options, poolOptions); } return pool; }