Package io.vertx.pgclient
Class PgConnectOptions
- java.lang.Object
- 
- io.vertx.sqlclient.SqlConnectOptions
- 
- io.vertx.pgclient.PgConnectOptions
 
 
- 
 public class PgConnectOptions extends SqlConnectOptions - Author:
- Julien Viet, Billy Yuan 
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_DATABASEstatic StringDEFAULT_HOSTstatic StringDEFAULT_PASSWORDstatic intDEFAULT_PIPELINING_LIMITstatic intDEFAULT_PORTstatic Map<String,String>DEFAULT_PROPERTIESstatic SslModeDEFAULT_SSLMODEstatic booleanDEFAULT_USE_LAYER_7_PROXYstatic StringDEFAULT_USER- 
Fields inherited from class io.vertx.sqlclient.SqlConnectOptionsDEFAULT_CACHE_PREPARED_STATEMENTS, DEFAULT_METRICS_NAME, DEFAULT_PREPARED_STATEMENT_CACHE_FILTER, DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE, DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL
 
- 
 - 
Constructor SummaryConstructors Constructor Description PgConnectOptions()PgConnectOptions(JsonObject json)PgConnectOptions(PgConnectOptions other)PgConnectOptions(SqlConnectOptions other)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgConnectOptionsaddProperty(String key, String value)Add a property for this client, which will be sent to server at the connection start.booleanequals(Object o)static PgConnectOptionsfromEnv()Provide aPgConnectOptionsconfigured with environment variables, if the environment variable is not set, then a default value will take precedence over this.static PgConnectOptionsfromUri(String connectionUri)Provide aPgConnectOptionsconfigured from a connection URI.intgetPipeliningLimit()SocketAddressgetSocketAddress()SslModegetSslMode()booleangetUseLayer7Proxy()inthashCode()protected voidinit()Initialize with the default options.booleanisUsingDomainSocket()PgConnectOptionsmerge(JsonObject other)Returns new options created after this object and merged with theotherjson config.PgConnectOptionssetCachePreparedStatements(boolean cachePreparedStatements)Set whether prepared statements cache should be enabled.PgConnectOptionssetDatabase(String database)Specify the default database for the connection.PgConnectOptionssetHost(String host)Specify the host for connecting to the server.PgConnectOptionssetPassword(String password)Specify the user password to be used for the authentication.PgConnectOptionssetPipeliningLimit(int pipeliningLimit)PgConnectOptionssetPort(int port)Specify the port for connecting to the server.PgConnectOptionssetPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)Set the maximum number of prepared statements that the connection will cache.PgConnectOptionssetPreparedStatementCacheSqlFilter(Predicate<String> predicate)Set a predicate filtering prepared statements that the connection will cache.PgConnectOptionssetPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)Set the maximum length of prepared statement SQL string that the connection will cache.PgConnectOptionssetProperties(Map<String,String> properties)Set properties for this client, which will be sent to server at the connection start.PgConnectOptionssetReconnectAttempts(int attempts)Set the value of reconnect attemptsPgConnectOptionssetReconnectInterval(long interval)Set the reconnect intervalPgConnectOptionssetSslMode(SslMode sslmode)SetSslModefor the client, this option can be used to provide different levels of secure protection.PgConnectOptionssetSslOptions(ClientSSLOptions sslOptions)PgConnectOptionssetTracingPolicy(TracingPolicy tracingPolicy)Set the tracing policy for the client behavior when Vert.x has tracing enabled.PgConnectOptionssetUseLayer7Proxy(boolean useLayer7Proxy)Set the client to use a layer 7 (application) proxy compatible protocol, set totruewhen the client interacts with a layer 7 proxy like PgBouncer instead of a server.PgConnectOptionssetUser(String user)Specify the user account to be used for the authentication.JsonObjecttoJson()static PgConnectOptionswrap(SqlConnectOptions options)- 
Methods inherited from class io.vertx.sqlclient.SqlConnectOptionsgetCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSslOptions, getTracingPolicy, getUser, setMetricsName
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_HOSTpublic static final String DEFAULT_HOST - See Also:
- Constant Field Values
 
 - 
DEFAULT_PORTpublic static int DEFAULT_PORT 
 - 
DEFAULT_DATABASEpublic static final String DEFAULT_DATABASE - See Also:
- Constant Field Values
 
 - 
DEFAULT_USERpublic static final String DEFAULT_USER - See Also:
- Constant Field Values
 
 - 
DEFAULT_PASSWORDpublic static final String DEFAULT_PASSWORD - See Also:
- Constant Field Values
 
 - 
DEFAULT_PIPELINING_LIMITpublic static final int DEFAULT_PIPELINING_LIMIT - See Also:
- Constant Field Values
 
 - 
DEFAULT_SSLMODEpublic static final SslMode DEFAULT_SSLMODE 
 - 
DEFAULT_USE_LAYER_7_PROXYpublic static final boolean DEFAULT_USE_LAYER_7_PROXY - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
PgConnectOptionspublic PgConnectOptions() 
 - 
PgConnectOptionspublic PgConnectOptions(JsonObject json) 
 - 
PgConnectOptionspublic PgConnectOptions(SqlConnectOptions other) 
 - 
PgConnectOptionspublic PgConnectOptions(PgConnectOptions other) 
 
- 
 - 
Method Detail- 
wrappublic static PgConnectOptions wrap(SqlConnectOptions options) - Returns:
- the optionsas PostgreSQL specific connect options
 
 - 
fromUripublic static PgConnectOptions fromUri(String connectionUri) throws IllegalArgumentException Provide aPgConnectOptionsconfigured from a connection URI.- Parameters:
- connectionUri- the connection URI to configure from
- Returns:
- a PgConnectOptionsparsed from the connection URI
- Throws:
- IllegalArgumentException- when the- connectionUriis in an invalid format
 
 - 
fromEnvpublic static PgConnectOptions fromEnv() Provide aPgConnectOptionsconfigured with environment variables, if the environment variable is not set, then a default value will take precedence over this.
 - 
setHostpublic PgConnectOptions setHost(String host) Description copied from class:SqlConnectOptionsSpecify the host for connecting to the server.- Overrides:
- setHostin class- SqlConnectOptions
- Parameters:
- host- the host to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setPortpublic PgConnectOptions setPort(int port) Description copied from class:SqlConnectOptionsSpecify the port for connecting to the server.- Overrides:
- setPortin class- SqlConnectOptions
- Parameters:
- port- the port to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setUserpublic PgConnectOptions setUser(String user) Description copied from class:SqlConnectOptionsSpecify the user account to be used for the authentication.- Overrides:
- setUserin class- SqlConnectOptions
- Parameters:
- user- the user to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setPasswordpublic PgConnectOptions setPassword(String password) Description copied from class:SqlConnectOptionsSpecify the user password to be used for the authentication.- Overrides:
- setPasswordin class- SqlConnectOptions
- Parameters:
- password- the password to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setDatabasepublic PgConnectOptions setDatabase(String database) Description copied from class:SqlConnectOptionsSpecify the default database for the connection.- Overrides:
- setDatabasein class- SqlConnectOptions
- Parameters:
- database- the database name to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
getPipeliningLimitpublic int getPipeliningLimit() 
 - 
setPipeliningLimitpublic PgConnectOptions setPipeliningLimit(int pipeliningLimit) 
 - 
setCachePreparedStatementspublic PgConnectOptions setCachePreparedStatements(boolean cachePreparedStatements) Description copied from class:SqlConnectOptionsSet whether prepared statements cache should be enabled.- Overrides:
- setCachePreparedStatementsin class- SqlConnectOptions
- Parameters:
- cachePreparedStatements- true if cache should be enabled
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setPreparedStatementCacheMaxSizepublic PgConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize) Description copied from class:SqlConnectOptionsSet the maximum number of prepared statements that the connection will cache.- Overrides:
- setPreparedStatementCacheMaxSizein class- SqlConnectOptions
- Parameters:
- preparedStatementCacheMaxSize- the size to set
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setPreparedStatementCacheSqlFilterpublic PgConnectOptions setPreparedStatementCacheSqlFilter(Predicate<String> predicate) Description copied from class:SqlConnectOptionsSet a predicate filtering prepared statements that the connection will cache.The default predicate accepts predicate having query length < SqlConnectOptions.DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT- Overrides:
- setPreparedStatementCacheSqlFilterin class- SqlConnectOptions
- Parameters:
- predicate- the filter
 
 - 
setPreparedStatementCacheSqlLimitpublic PgConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit) Description copied from class:SqlConnectOptionsSet the maximum length of prepared statement SQL string that the connection will cache.This is an helper setting the SqlConnectOptions.setPreparedStatementCacheSqlFilter(Predicate).- Overrides:
- setPreparedStatementCacheSqlLimitin class- SqlConnectOptions
- Parameters:
- preparedStatementCacheSqlLimit- the maximum length limit of SQL string to set
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setPropertiespublic PgConnectOptions setProperties(Map<String,String> properties) Description copied from class:SqlConnectOptionsSet properties for this client, which will be sent to server at the connection start.- Overrides:
- setPropertiesin class- SqlConnectOptions
- Parameters:
- properties- the value of properties to specify
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
addPropertypublic PgConnectOptions addProperty(String key, String value) Description copied from class:SqlConnectOptionsAdd a property for this client, which will be sent to server at the connection start.- Overrides:
- addPropertyin class- SqlConnectOptions
- Parameters:
- key- the value of property key
- value- the value of property value
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
getSslModepublic SslMode getSslMode() - Returns:
- the value of current sslmode
 
 - 
setSslModepublic PgConnectOptions setSslMode(SslMode sslmode) SetSslModefor the client, this option can be used to provide different levels of secure protection.- Parameters:
- sslmode- the value of sslmode
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
getUseLayer7Proxy@Unstable public boolean getUseLayer7Proxy() - Returns:
- whether the client interacts with a layer 7 proxy instead of a server
 
 - 
setUseLayer7Proxy@Unstable public PgConnectOptions setUseLayer7Proxy(boolean useLayer7Proxy) Set the client to use a layer 7 (application) proxy compatible protocol, set totruewhen the client interacts with a layer 7 proxy like PgBouncer instead of a server. Prepared statement caching must be disabled.- Parameters:
- useLayer7Proxy- whether to use a layer 7 proxy instead of a server
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setReconnectAttemptspublic PgConnectOptions setReconnectAttempts(int attempts) Description copied from class:SqlConnectOptionsSet the value of reconnect attempts- Overrides:
- setReconnectAttemptsin class- SqlConnectOptions
- Parameters:
- attempts- the maximum number of reconnect attempts
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setReconnectIntervalpublic PgConnectOptions setReconnectInterval(long interval) Description copied from class:SqlConnectOptionsSet the reconnect interval- Overrides:
- setReconnectIntervalin class- SqlConnectOptions
- Parameters:
- interval- the reconnect interval in ms
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setTracingPolicypublic PgConnectOptions setTracingPolicy(TracingPolicy tracingPolicy) Description copied from class:SqlConnectOptionsSet the tracing policy for the client behavior when Vert.x has tracing enabled.- Overrides:
- setTracingPolicyin class- SqlConnectOptions
- Parameters:
- tracingPolicy- the tracing policy
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
setSslOptionspublic PgConnectOptions setSslOptions(ClientSSLOptions sslOptions) - Overrides:
- setSslOptionsin class- SqlConnectOptions
 
 - 
initprotected void init() Initialize with the default options.- Overrides:
- initin class- SqlConnectOptions
 
 - 
toJsonpublic JsonObject toJson() - Overrides:
- toJsonin class- SqlConnectOptions
 
 - 
getSocketAddresspublic SocketAddress getSocketAddress() - Overrides:
- getSocketAddressin class- SqlConnectOptions
 
 - 
isUsingDomainSocketpublic boolean isUsingDomainSocket() - Overrides:
- isUsingDomainSocketin class- SqlConnectOptions
 
 - 
mergepublic PgConnectOptions merge(JsonObject other) Description copied from class:SqlConnectOptionsReturns new options created after this object and merged with theotherjson config.- Overrides:
- mergein class- SqlConnectOptions
- Parameters:
- other- the other JSON object
- Returns:
- new options created after this object and merged with the otherjson config
 
 
- 
 
-