Interface FeedClientBuilder


public interface FeedClientBuilder
Builder for creating a FeedClient instance.
Author:
bjorncs, jonmv
  • Field Details

  • Method Details

    • create

      static FeedClientBuilder create(URI endpoint)
      Creates a builder for a single container endpoint
    • create

      static FeedClientBuilder create(List<URI> endpoints)
      Creates a builder for multiple container endpoints
    • setFeedClientBuilderSupplier

      static void setFeedClientBuilderSupplier(Supplier<FeedClientBuilder> supplier)
      Override FeedClientBuilder. This will be preferred in create(java.net.URI)
    • setConnectionsPerEndpoint

      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

      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

      FeedClientBuilder setSslContext(SSLContext context)
      Sets SSLContext instance.
    • setHostnameVerifier

      FeedClientBuilder setHostnameVerifier(HostnameVerifier verifier)
      Sets HostnameVerifier instance (e.g for disabling default SSL hostname verification).
    • noBenchmarking

      FeedClientBuilder noBenchmarking()
      Turns off benchmarking. Attempting to get FeedClient.stats() will result in an exception.
    • addRequestHeader

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

      FeedClientBuilder 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.
    • setRetryStrategy

      FeedClientBuilder setRetryStrategy(FeedClient.RetryStrategy strategy)
      Overrides default retry strategy.
      See Also:
    • setCircuitBreaker

      FeedClientBuilder setCircuitBreaker(FeedClient.CircuitBreaker breaker)
      Overrides default circuit breaker.
      See Also:
    • setCertificate

      FeedClientBuilder setCertificate(Path certificatePemFile, Path privateKeyPemFile)
      Sets path to client SSL certificate/key PEM files
    • setCertificate

      FeedClientBuilder setCertificate(Collection<X509Certificate> certificate, PrivateKey privateKey)
      Sets client SSL certificates/key
    • setCertificate

      FeedClientBuilder setCertificate(X509Certificate certificate, PrivateKey privateKey)
      Sets client SSL certificate/key
    • setDryrun

      FeedClientBuilder setDryrun(boolean enabled)
      Turns on dryrun mode, where each operation succeeds after a given delay, rather than being sent across the network.
    • setSpeedTest

      FeedClientBuilder setSpeedTest(boolean enabled)
      Turns on speed test mode, where all feed operations are immediately acknowledged by the server.
    • setCaCertificatesFile

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

      FeedClientBuilder setCaCertificates(Collection<X509Certificate> caCertificates)
      Overrides JVM default SSL truststore
    • setEndpointUris

      FeedClientBuilder setEndpointUris(List<URI> endpoints)
      Overrides endpoint URIs for this client
    • setProxy

      FeedClientBuilder setProxy(URI uri)
      Specify HTTP(S) proxy for all endpoints
    • build

      FeedClient build()
      Constructs instance of FeedClient from builder configuration