Class FeedClientBuilderImpl

  • All Implemented Interfaces:
    ai.vespa.feed.client.FeedClientBuilder

    public class FeedClientBuilderImpl
    extends Object
    implements ai.vespa.feed.client.FeedClientBuilder
    Builder for creating a FeedClient instance.
    Author:
    bjorncs, jonmv
    • Constructor Detail

      • FeedClientBuilderImpl

        public FeedClientBuilderImpl()
    • Method Detail

      • setEndpointUris

        public ai.vespa.feed.client.FeedClientBuilder setEndpointUris​(List<URI> endpoints)
        Specified by:
        setEndpointUris in interface ai.vespa.feed.client.FeedClientBuilder
      • setConnectionsPerEndpoint

        public FeedClientBuilderImpl setConnectionsPerEndpoint​(int max)
        Specified by:
        setConnectionsPerEndpoint in interface ai.vespa.feed.client.FeedClientBuilder
      • setMaxStreamPerConnection

        public FeedClientBuilderImpl setMaxStreamPerConnection​(int max)
        Specified by:
        setMaxStreamPerConnection in interface ai.vespa.feed.client.FeedClientBuilder
      • setHostnameVerifier

        public FeedClientBuilderImpl setHostnameVerifier​(HostnameVerifier verifier)
        Sets HostnameVerifier instance (e.g for disabling default SSL hostname verification).
        Specified by:
        setHostnameVerifier in interface ai.vespa.feed.client.FeedClientBuilder
      • noBenchmarking

        public FeedClientBuilderImpl noBenchmarking()
        Turns off benchmarking. Attempting to get FeedClient.stats() will result in an exception.
        Specified by:
        noBenchmarking in interface ai.vespa.feed.client.FeedClientBuilder
      • addRequestHeader

        public FeedClientBuilderImpl addRequestHeader​(String name,
                                                      String value)
        Adds HTTP request header to all client requests.
        Specified by:
        addRequestHeader in interface ai.vespa.feed.client.FeedClientBuilder
      • addRequestHeader

        public FeedClientBuilderImpl addRequestHeader​(String name,
                                                      Supplier<String> valueSupplier)
        Adds HTTP request header to all client requests. Value Supplier is invoked for each HTTP request, i.e. value can be dynamically updated during a feed.
        Specified by:
        addRequestHeader in interface ai.vespa.feed.client.FeedClientBuilder
      • setRetryStrategy

        public FeedClientBuilderImpl setRetryStrategy​(ai.vespa.feed.client.FeedClient.RetryStrategy strategy)
        Overrides default retry strategy.
        Specified by:
        setRetryStrategy in interface ai.vespa.feed.client.FeedClientBuilder
        See Also:
        FeedClient.RetryStrategy
      • setCircuitBreaker

        public FeedClientBuilderImpl setCircuitBreaker​(ai.vespa.feed.client.FeedClient.CircuitBreaker breaker)
        Overrides default circuit breaker.
        Specified by:
        setCircuitBreaker in interface ai.vespa.feed.client.FeedClientBuilder
        See Also:
        FeedClient.CircuitBreaker
      • setCertificate

        public FeedClientBuilderImpl setCertificate​(Path certificatePemFile,
                                                    Path privateKeyPemFile)
        Sets path to client SSL certificate/key PEM files
        Specified by:
        setCertificate in interface ai.vespa.feed.client.FeedClientBuilder
      • setCertificate

        public FeedClientBuilderImpl setCertificate​(X509Certificate certificate,
                                                    PrivateKey privateKey)
        Sets client SSL certificate/key
        Specified by:
        setCertificate in interface ai.vespa.feed.client.FeedClientBuilder
      • setDryrun

        public FeedClientBuilderImpl setDryrun​(boolean enabled)
        Specified by:
        setDryrun in interface ai.vespa.feed.client.FeedClientBuilder
      • setCaCertificatesFile

        public FeedClientBuilderImpl setCaCertificatesFile​(Path caCertificatesFile)
        Overrides JVM default SSL truststore
        Specified by:
        setCaCertificatesFile in interface ai.vespa.feed.client.FeedClientBuilder
        Parameters:
        caCertificatesFile - Path to PEM encoded file containing trusted certificates
      • setCaCertificates

        public FeedClientBuilderImpl setCaCertificates​(Collection<X509Certificate> caCertificates)
        Overrides JVM default SSL truststore
        Specified by:
        setCaCertificates in interface ai.vespa.feed.client.FeedClientBuilder
      • build

        public ai.vespa.feed.client.FeedClient build()
        Constructs instance of FeedClient from builder configuration
        Specified by:
        build in interface ai.vespa.feed.client.FeedClientBuilder