Class FeedClientBuilder


  • public class FeedClientBuilder
    extends java.lang.Object
    Builder for creating a FeedClient instance.
    Author:
    bjorncs, jonmv
    • Method Detail

      • create

        public static FeedClientBuilder create​(java.net.URI endpoint)
        Creates a builder for a single container endpoint
      • create

        public static FeedClientBuilder create​(java.util.List<java.net.URI> endpoints)
        Creates a builder for multiple container endpoints
      • setConnectionsPerEndpoint

        public FeedClientBuilder setConnectionsPerEndpoint​(int max)
        Sets the number of connections this client will use per endpoint. A reasonable value here is a value that lets all feed clients (if more than one) collectively have a number of connections which is a small multiple of the numbers of containers in the cluster to feed, so load can be balanced across these containers. In general, this value should be kept as low as possible, but poor connectivity between feeder and cluster may also warrant a higher number of connections.
      • setMaxStreamPerConnection

        public FeedClientBuilder setMaxStreamPerConnection​(int max)
        Sets the maximum number of streams per HTTP/2 connection for this client. This determines the maximum number of concurrent, inflight requests for this client, which is maxConnections * maxStreamsPerConnection. Prefer more streams over more connections, when possible. The feed client automatically throttles load to achieve the best throughput, and the actual number of streams per connection is usually lower than the maximum.
      • setSslContext

        public FeedClientBuilder setSslContext​(javax.net.ssl.SSLContext context)
        Sets SSLContext instance.
      • setHostnameVerifier

        public FeedClientBuilder setHostnameVerifier​(javax.net.ssl.HostnameVerifier verifier)
        Sets HostnameVerifier instance (e.g for disabling default SSL hostname verification).
      • addRequestHeader

        public FeedClientBuilder addRequestHeader​(java.lang.String name,
                                                  java.lang.String value)
        Adds HTTP request header to all client requests.
      • addRequestHeader

        public FeedClientBuilder addRequestHeader​(java.lang.String name,
                                                  java.util.function.Supplier<java.lang.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.
      • setCertificate

        public FeedClientBuilder setCertificate​(java.nio.file.Path certificatePemFile,
                                                java.nio.file.Path privateKeyPemFile)
        Sets path to client SSL certificate/key PEM files
      • setCertificate

        public FeedClientBuilder setCertificate​(java.util.Collection<java.security.cert.X509Certificate> certificate,
                                                java.security.PrivateKey privateKey)
        Sets client SSL certificates/key
      • setCertificate

        public FeedClientBuilder setCertificate​(java.security.cert.X509Certificate certificate,
                                                java.security.PrivateKey privateKey)
        Sets client SSL certificate/key
      • setCaCertificatesFile

        public FeedClientBuilder setCaCertificatesFile​(java.nio.file.Path caCertificatesFile)
        Overrides JVM default SSL truststore
        Parameters:
        caCertificatesFile - Path to PEM encoded file containing trusted certificates
      • setCaCertificates

        public FeedClientBuilder setCaCertificates​(java.util.Collection<java.security.cert.X509Certificate> caCertificates)
        Overrides JVM default SSL truststore