public static final class PostgresqlConnectionConfiguration.Builder extends Object
PostgresqlConnectionConfiguration instances.
This class is not threadsafe
| Modifier and Type | Method and Description |
|---|---|
PostgresqlConnectionConfiguration.Builder |
applicationName(String applicationName)
Configure the application name.
|
PostgresqlConnectionConfiguration.Builder |
autodetectExtensions(boolean autodetectExtensions)
Configures whether to use
ServiceLoader to discover and register extensions. |
PostgresqlConnectionConfiguration |
build()
Returns a configured
PostgresqlConnectionConfiguration. |
PostgresqlConnectionConfiguration.Builder |
codecRegistrar(CodecRegistrar codecRegistrar)
Registers a
CodecRegistrar that can contribute extension Codecs. |
PostgresqlConnectionConfiguration.Builder |
compatibilityMode(boolean compatibilityMode)
Enables protocol compatibility mode for cursored query execution.
|
PostgresqlConnectionConfiguration.Builder |
connectTimeout(Duration connectTimeout)
Configures the connection timeout.
|
PostgresqlConnectionConfiguration.Builder |
database(String database)
Configure the database.
|
PostgresqlConnectionConfiguration.Builder |
enableSsl()
Enable SSL usage.
|
PostgresqlConnectionConfiguration.Builder |
extendWith(Extension extension)
Registers a
Extension to extend driver functionality. |
PostgresqlConnectionConfiguration.Builder |
fetchSize(int fetchSize)
Set the default number of rows to return when fetching results from a query.
|
PostgresqlConnectionConfiguration.Builder |
fetchSize(ToIntFunction<String> fetchSizeFunction)
Set a function that maps a SQL query to the number of rows to return when fetching results for that query.
|
PostgresqlConnectionConfiguration.Builder |
forceBinary(boolean forceBinary)
Force binary results (Binary Transfer).
|
PostgresqlConnectionConfiguration.Builder |
host(String host)
Configure the host.
|
PostgresqlConnectionConfiguration.Builder |
lockWaitTimeout(Duration lockWaitTimeout)
Configure the Lock wait timeout.
|
PostgresqlConnectionConfiguration.Builder |
loopResources(reactor.netty.resources.LoopResources loopResources)
Configure
LoopResources. |
PostgresqlConnectionConfiguration.Builder |
options(Map<String,String> options)
Configure connection initialization parameters.
|
PostgresqlConnectionConfiguration.Builder |
password(CharSequence password)
Configure the password.
|
PostgresqlConnectionConfiguration.Builder |
port(int port)
Configure the port.
|
PostgresqlConnectionConfiguration.Builder |
preferAttachedBuffers(boolean preferAttachedBuffers)
Configure whether
codecs should prefer attached data buffers. |
PostgresqlConnectionConfiguration.Builder |
preparedStatementCacheQueries(int preparedStatementCacheQueries)
Configure the preparedStatementCacheQueries.
|
PostgresqlConnectionConfiguration.Builder |
schema(String schema)
Configure the schema.
|
PostgresqlConnectionConfiguration.Builder |
socket(String socket)
Configure the unix domain socket to connect to.
|
PostgresqlConnectionConfiguration.Builder |
sslCert(String sslCert)
Configure ssl cert for client certificate authentication.
|
PostgresqlConnectionConfiguration.Builder |
sslCert(URL sslCert)
Configure ssl cert for client certificate authentication.
|
PostgresqlConnectionConfiguration.Builder |
sslContextBuilderCustomizer(Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContextBuilder> sslContextBuilderCustomizer)
Configure a
SslContextBuilder customizer. |
PostgresqlConnectionConfiguration.Builder |
sslHostnameVerifier(HostnameVerifier sslHostnameVerifier)
Configure ssl HostnameVerifier.
|
PostgresqlConnectionConfiguration.Builder |
sslKey(String sslKey)
Configure ssl key for client certificate authentication.
|
PostgresqlConnectionConfiguration.Builder |
sslKey(URL sslKey)
Configure ssl key for client certificate authentication.
|
PostgresqlConnectionConfiguration.Builder |
sslMode(io.r2dbc.postgresql.client.SSLMode sslMode)
Configure ssl mode.
|
PostgresqlConnectionConfiguration.Builder |
sslPassword(CharSequence sslPassword)
Configure ssl password.
|
PostgresqlConnectionConfiguration.Builder |
sslRootCert(String sslRootCert)
Configure ssl root cert for server certificate validation.
|
PostgresqlConnectionConfiguration.Builder |
sslRootCert(URL sslRootCert)
Configure ssl root cert for server certificate validation.
|
PostgresqlConnectionConfiguration.Builder |
statementTimeout(Duration statementTimeout)
Configure the Statement timeout.
|
PostgresqlConnectionConfiguration.Builder |
tcpKeepAlive(boolean enabled)
Configure TCP KeepAlive.
|
PostgresqlConnectionConfiguration.Builder |
tcpNoDelay(boolean enabled)
Configure TCP NoDelay.
|
String |
toString() |
PostgresqlConnectionConfiguration.Builder |
username(String username)
Configure the username.
|
public PostgresqlConnectionConfiguration.Builder applicationName(String applicationName)
postgresql-r2dbc.applicationName - the application namePostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if applicationName is nullpublic PostgresqlConnectionConfiguration.Builder autodetectExtensions(boolean autodetectExtensions)
ServiceLoader to discover and register extensions. Defaults to true.autodetectExtensions - to discover and register extensionsPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration build()
PostgresqlConnectionConfiguration.PostgresqlConnectionConfigurationpublic PostgresqlConnectionConfiguration.Builder compatibilityMode(boolean compatibilityMode)
Execute+Sync
messages instead of Execute+Flush. The default mode uses optimized fetching which does not work with newer pgpool versions.compatibilityMode - whether to enable compatibility modePostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder connectTimeout(@Nullable Duration connectTimeout)
connectTimeout - the connection timeoutPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder codecRegistrar(CodecRegistrar codecRegistrar)
CodecRegistrar that can contribute extension Codecs.
Calling this method adds a CodecRegistrar and does not replace existing Extensions.codecRegistrar - registrar to contribute codecsPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder database(@Nullable String database)
database - the databasePostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder enableSsl()
PostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder extendWith(Extension extension)
Extension to extend driver functionality.
Calling this method adds a Extension and does not replace existing Extensions.extension - extension to extend driver functionalityPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder fetchSize(int fetchSize)
fetchSize - the number of rows to fetchBuilderIllegalArgumentException - if fetchSize is negativepublic PostgresqlConnectionConfiguration.Builder fetchSize(ToIntFunction<String> fetchSizeFunction)
fetchSizeFunction - a function that maps the number of rows to fetchBuilderIllegalArgumentException - if fetchSizeFunction is nullpublic PostgresqlConnectionConfiguration.Builder forceBinary(boolean forceBinary)
forceBinary - whether to force binary transferPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder host(String host)
host - the hostPostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if host is nullpublic PostgresqlConnectionConfiguration.Builder lockWaitTimeout(Duration lockWaitTimeout)
This parameter is applied once after creating a new connection.
If lockTimeout is already set using options(Map), it will be overridden.
Lock Timeout
lockWaitTimeout - the lock timeoutPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder loopResources(reactor.netty.resources.LoopResources loopResources)
LoopResources.loopResources - the LoopResourcesPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder options(Map<String,String> options)
These parameters are applied once after creating a new connection. This is useful for setting up client-specific runtime parameters like statement timeouts, time zones etc.
options - the optionsPostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if options or any key or value of options is nullpublic PostgresqlConnectionConfiguration.Builder password(@Nullable CharSequence password)
password - the passwordPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder port(int port)
5432.port - the portPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder preferAttachedBuffers(boolean preferAttachedBuffers)
codecs should prefer attached data buffers. The default is false, meaning that codecs will copy data from the input buffer into a byte[]
or similar data structure that is enabled for garbage collection. Using attached buffers is more efficient but comes with the requirement that decoded values (such as Json) must
be consumed to release attached buffers to avoid memory leaks.preferAttachedBuffers - the flag whether to prefer attached buffersPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder preparedStatementCacheQueries(int preparedStatementCacheQueries)
-1, meaning there's no limit. The value of 0 disables the cache. Any other value specifies the cache size.preparedStatementCacheQueries - the preparedStatementCacheQueriesPostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if username is nullpublic PostgresqlConnectionConfiguration.Builder schema(@Nullable String schema)
schema - the schemaPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder socket(String socket)
socket - the socket pathPostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if socket is nullpublic PostgresqlConnectionConfiguration.Builder sslContextBuilderCustomizer(Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContextBuilder> sslContextBuilderCustomizer)
SslContextBuilder customizer. The customizer gets applied on each SSL connection attempt to allow for just-in-time configuration updates. The Function gets
called with the prepared SslContextBuilder that has all configuration options applied. The customizer may return the same builder or return a new builder instance to be used to
build the SSL context.sslContextBuilderCustomizer - customizer functionPostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if sslContextBuilderCustomizer is nullpublic PostgresqlConnectionConfiguration.Builder sslCert(String sslCert)
sslCert - an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslCert(URL sslCert)
sslCert - an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslHostnameVerifier(HostnameVerifier sslHostnameVerifier)
sslHostnameVerifier - HostnameVerifierPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslKey(String sslKey)
sslKey - a PKCS#8 private key file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslKey(URL sslKey)
sslKey - a PKCS#8 private key file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslMode(io.r2dbc.postgresql.client.SSLMode sslMode)
sslMode - the SSL mode to use.PostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslPassword(@Nullable CharSequence sslPassword)
sslPassword - the password of the sslKey, or null if it's not password-protectedPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslRootCert(String sslRootCert)
sslRootCert - an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder sslRootCert(URL sslRootCert)
sslRootCert - an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder statementTimeout(Duration statementTimeout)
This parameter is applied once after creating a new connection.
If statementTimeout is already set using options(Map), it will be overridden.
Statement Timeout
statementTimeout - the statement timeoutPostgresqlConnectionConfiguration.Builderpublic PostgresqlConnectionConfiguration.Builder tcpKeepAlive(boolean enabled)
enabled - whether to enable TCP KeepAlivePostgresqlConnectionConfiguration.BuilderSocket.setKeepAlive(boolean)public PostgresqlConnectionConfiguration.Builder tcpNoDelay(boolean enabled)
enabled - whether to enable TCP NoDelayPostgresqlConnectionConfiguration.BuilderSocket.setTcpNoDelay(boolean)public PostgresqlConnectionConfiguration.Builder username(String username)
username - the usernamePostgresqlConnectionConfiguration.BuilderIllegalArgumentException - if username is nullCopyright © 2022. All rights reserved.