Class ConnectionParams.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • setUseTlsConfigFromEnvironment

        public ConnectionParams.Builder setUseTlsConfigFromEnvironment​(boolean useTlsConfigFromEnvironment)
        Use TLS configuration through the standard Vespa environment variables. Setting this to 'true' will override any other TLS/HTTPS related configuration.
      • setSslContext

        public ConnectionParams.Builder setSslContext​( sslContext)
        Sets the SSLContext for the connection to the gateway when SSL is enabled for Endpoint. Default null (no ssl). See also Endpoint configuration.
        sslContext - sslContext for connection to gateway.
        pointer to builder.
      • setHostnameVerifier

        public ConnectionParams.Builder setHostnameVerifier​( hostnameVerifier)
        Sets the HostnameVerifier for the connection to the gateway when SSL is enabled for Endpoint. Defaults to instance returned by SSLConnectionSocketFactory.getDefaultHostnameVerifier().
        hostnameVerifier - hostname verifier for connection to gateway.
        pointer to builder.
      • setCertificateAndPrivateKey

        public ConnectionParams.Builder setCertificateAndPrivateKey​(java.nio.file.Path privateKey,
                                                                    java.nio.file.Path certificate)
        Set path to private key and certificate files. Both the private key and certificate must be PEM-encoded.
      • setCaCertificates

        public ConnectionParams.Builder setCaCertificates​(java.nio.file.Path caCertificates)
        Set path a PEM file containing the CA certificates.
      • addHeader

        public ConnectionParams.Builder addHeader​(java.lang.String key,
                                                  java.lang.String value)
        Set custom headers to be used
        key - header name
        value - header value
        pointer to builder.
      • addDynamicHeader

        public ConnectionParams.Builder addDynamicHeader​(java.lang.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 one ConnectionParams.HeaderProvider is allowed for a given header name.
        provider - A provider for a dynamic header
        pointer to builder.
        java.lang.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.
        numPersistentConnectionsPerEndpoint - number of channels per endpoint
        pointer to builder.
      • setProxyHost

        public ConnectionParams.Builder setProxyHost​(java.lang.String proxyHost)
        Sets the HTTP proxy host name to use.
        proxyHost - host name for proxy.
        pointer to builder.
      • setProxyPort

        public ConnectionParams.Builder setProxyPort​(int proxyPort)
        Sets the HTTP proxy host port to use.
        proxyPort - host port for proxy.
        pointer to builder.
      • setUseCompression

        public ConnectionParams.Builder setUseCompression​(boolean useCompression)
        Set whether compression of document operations during communication to server should be enabled.
        useCompression - true if compression should be enabled.
        pointer to builder.
      • setMaxRetries

        public ConnectionParams.Builder setMaxRetries​(int maxRetries)
        Set how many times to retry sending an operation to a gateway when encountering transient problems.
        maxRetries - max number of retries
        pointer to builder.
      • setDryRun

        public ConnectionParams.Builder setDryRun​(boolean dryRun)
        Set to true to skip making network connections and instead let requests complete successfully with no effect.
      • setRunThreads

        public ConnectionParams.Builder setRunThreads​(boolean runThreads)
        Set to false to skip starting io threads, such that any operation must be driven by a calling thread. Useful for testing.
      • setMinTimeBetweenRetries

        public ConnectionParams.Builder setMinTimeBetweenRetries​(long minTimeBetweenRetries,
                                                                 java.util.concurrent.TimeUnit unit)
        Set the min time between retries when temporarily failing against a gateway.
        minTimeBetweenRetries - the min time value
        unit - the unit of the min time.
        pointer to builder.
      • getMinTimeBetweenRetriesMs

        public long getMinTimeBetweenRetriesMs()
      • setTraceLevel

        public ConnectionParams.Builder setTraceLevel​(int traceLevel)
        Sets the trace level for tracing messagebus. 0 means to tracing.
        traceLevel - tracelevel, larger value means more tracing.
        pointer to builder.
      • setTraceEveryXOperation

        public ConnectionParams.Builder setTraceEveryXOperation​(int traceEveryXOperation)
        How often to trace messages in client. Please note that this does not affect tracing with messagebus
        traceEveryXOperation - if zero, no tracing, 1 = every message, and so on.
        pointer to builder.
      • setPrintTraceToStdErr

        public ConnectionParams.Builder setPrintTraceToStdErr​(boolean printTraceToStdErr)
        If enabled will write internal trace to stderr.
        printTraceToStdErr - if value is true it is enabled.
        pointer to builder.
      • setConnectionTimeToLive

        public ConnectionParams.Builder setConnectionTimeToLive​(java.time.Duration connectionTimeToLive)
        Set the maximum time to live for persistent connections
      • getNumPersistentConnectionsPerEndpoint

        public int getNumPersistentConnectionsPerEndpoint()
      • getProxyHost

        public java.lang.String 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

        public getSslContext()
      • getHostnameVerifier

        public getHostnameVerifier()
      • useTlsConfigFromEnvironment

        public boolean useTlsConfigFromEnvironment()
      • getConnectionTimeToLive

        public java.time.Duration getConnectionTimeToLive()
      • getPrivateKey

        public java.nio.file.Path getPrivateKey()
      • getCertificate

        public java.nio.file.Path getCertificate()
      • getCaCertificates

        public java.nio.file.Path getCaCertificates()