Class ConnectionParams.Builder
java.lang.Object
com.yahoo.vespa.http.client.config.ConnectionParams.Builder
- Enclosing class:
- ConnectionParams
Builder for
ConnectionParams
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDynamicHeader
(String headerName, ConnectionParams.HeaderProvider provider) Adds a header provider for dynamic headers; headers where the value may change during a feeding session (e.g.Set custom headers to be usedbuild()
int
long
int
boolean
int
int
int
boolean
isDryRun()
boolean
setCaCertificates
(Path caCertificates) Set path a PEM file containing the CA certificates.setCertificateAndPrivateKey
(Path privateKey, Path certificate) Set path to private key and certificate files.setConnectionTimeToLive
(Duration connectionTimeToLive) Set the maximum time to live for persistent connectionssetDryRun
(boolean dryRun) Set to true to skip making network connections and instead let requests complete successfully with no effect.setHostnameVerifier
(HostnameVerifier hostnameVerifier) Sets theHostnameVerifier
for the connection to the gateway when SSL is enabled for Endpoint.setMaxRetries
(int maxRetries) Set how many times to retry sending an operation to a gateway when encountering transient problems.setMinTimeBetweenRetries
(long minTimeBetweenRetries, TimeUnit unit) Set the min time between retries when temporarily failing against a gateway.setNumPersistentConnectionsPerEndpoint
(int numPersistentConnectionsPerEndpoint) The number of connections between the http client and the gateways.setPrintTraceToStdErr
(boolean printTraceToStdErr) If enabled will write internal trace to stderr.setProxyHost
(String proxyHost) Sets the HTTP proxy host name to use.setProxyPort
(int proxyPort) Sets the HTTP proxy host port to use.setRunThreads
(boolean runThreads) Set to false to skip starting io threads, such that any operation must be driven by a calling thread.setSslContext
(SSLContext sslContext) Sets the SSLContext for the connection to the gateway when SSL is enabled for Endpoint.setTraceEveryXOperation
(int traceEveryXOperation) How often to trace messages in client.setTraceLevel
(int traceLevel) Sets the trace level for tracing messagebus.setUseCompression
(boolean useCompression) Set whether compression of document operations during communication to server should be enabled.setUseTlsConfigFromEnvironment
(boolean useTlsConfigFromEnvironment) Use TLS configuration through the standard Vespa environment variables.boolean
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setUseTlsConfigFromEnvironment
Use TLS configuration through the standard Vespa environment variables. Setting this to 'true' will override any other TLS/HTTPS related configuration. -
setSslContext
Sets the SSLContext for the connection to the gateway when SSL is enabled for Endpoint. Default null (no ssl). See also Endpoint configuration.- Parameters:
sslContext
- sslContext for connection to gateway.- Returns:
- pointer to builder.
-
setHostnameVerifier
Sets theHostnameVerifier
for the connection to the gateway when SSL is enabled for Endpoint. Defaults to instance returned bySSLConnectionSocketFactory.getDefaultHostnameVerifier()
.- Parameters:
hostnameVerifier
- hostname verifier for connection to gateway.- Returns:
- pointer to builder.
-
setCertificateAndPrivateKey
Set path to private key and certificate files. Both the private key and certificate must be PEM-encoded. -
setCaCertificates
Set path a PEM file containing the CA certificates. -
addHeader
Set custom headers to be used- Parameters:
key
- header namevalue
- header value- Returns:
- pointer to builder.
-
addDynamicHeader
public ConnectionParams.Builder addDynamicHeader(String headerName, ConnectionParams.HeaderProvider provider) Adds a header provider for dynamic headers; headers where the value may change during a feeding session (e.g. security tokens with limited life time). Only oneConnectionParams.HeaderProvider
is allowed for a given header name.- Parameters:
provider
- A provider for a dynamic header- Returns:
- pointer to builder.
- Throws:
IllegalArgumentException
- if a provider is already registered for the given header name
-
setNumPersistentConnectionsPerEndpoint
public ConnectionParams.Builder setNumPersistentConnectionsPerEndpoint(int numPersistentConnectionsPerEndpoint) The number of connections between the http client and the gateways. A very low number can result in the network not fully utilized and the round-trip time can be a limiting factor. A low number can cause skew in distribution of load between gateways. A too high number will cause many threads to run, more context switching and potential more memory usage. We recommend using about 16 connections per gateway.- Parameters:
numPersistentConnectionsPerEndpoint
- number of channels per endpoint- Returns:
- pointer to builder.
-
setProxyHost
Sets the HTTP proxy host name to use.- Parameters:
proxyHost
- host name for proxy.- Returns:
- pointer to builder.
-
setProxyPort
Sets the HTTP proxy host port to use.- Parameters:
proxyPort
- host port for proxy.- Returns:
- pointer to builder.
-
setUseCompression
Set whether compression of document operations during communication to server should be enabled.- Parameters:
useCompression
- true if compression should be enabled.- Returns:
- pointer to builder.
-
setMaxRetries
Set how many times to retry sending an operation to a gateway when encountering transient problems.- Parameters:
maxRetries
- max number of retries- Returns:
- pointer to builder.
-
setDryRun
Set to true to skip making network connections and instead let requests complete successfully with no effect. -
setRunThreads
Set to false to skip starting io threads, such that any operation must be driven by a calling thread. Useful for testing. -
setMinTimeBetweenRetries
Set the min time between retries when temporarily failing against a gateway.- Parameters:
minTimeBetweenRetries
- the min time valueunit
- the unit of the min time.- Returns:
- pointer to builder.
-
getMinTimeBetweenRetriesMs
public long getMinTimeBetweenRetriesMs() -
setTraceLevel
Sets the trace level for tracing messagebus. 0 means to tracing.- Parameters:
traceLevel
- tracelevel, larger value means more tracing.- Returns:
- pointer to builder.
-
setTraceEveryXOperation
How often to trace messages in client. Please note that this does not affect tracing with messagebus- Parameters:
traceEveryXOperation
- if zero, no tracing, 1 = every message, and so on.- Returns:
- pointer to builder.
-
setPrintTraceToStdErr
If enabled will write internal trace to stderr.- Parameters:
printTraceToStdErr
- if value is true it is enabled.- Returns:
- pointer to builder.
-
setConnectionTimeToLive
Set the maximum time to live for persistent connections -
build
-
getNumPersistentConnectionsPerEndpoint
public int getNumPersistentConnectionsPerEndpoint() -
getProxyHost
-
isDryRun
public boolean isDryRun() -
runThreads
public boolean runThreads() -
getMaxRetries
public int getMaxRetries() -
getTraceLevel
public int getTraceLevel() -
getTraceEveryXOperation
public int getTraceEveryXOperation() -
getPrintTraceToStdErr
public boolean getPrintTraceToStdErr() -
getProxyPort
public int getProxyPort() -
getSslContext
-
getHostnameVerifier
-
useTlsConfigFromEnvironment
public boolean useTlsConfigFromEnvironment() -
getConnectionTimeToLive
-
getPrivateKey
-
getCertificate
-
getCaCertificates
-