Package ai.vespa.feed.client
Interface FeedClientBuilder
-
public interface FeedClientBuilder
Builder for creating aFeedClient
instance.- Author:
- bjorncs, jonmv
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description FeedClientBuilder
addRequestHeader(String name, String value)
Adds HTTP request header to all client requests.FeedClientBuilder
addRequestHeader(String name, Supplier<String> valueSupplier)
Adds HTTP request header to all client requests.FeedClient
build()
Constructs instance ofFeedClient
from builder configurationstatic FeedClientBuilder
create(URI endpoint)
Creates a builder for a single container endpointstatic FeedClientBuilder
create(List<URI> endpoints)
Creates a builder for multiple container endpointsFeedClientBuilder
noBenchmarking()
Turns off benchmarking.FeedClientBuilder
setCaCertificates(Collection<X509Certificate> caCertificates)
Overrides JVM default SSL truststoreFeedClientBuilder
setCaCertificatesFile(Path caCertificatesFile)
Overrides JVM default SSL truststoreFeedClientBuilder
setCertificate(Path certificatePemFile, Path privateKeyPemFile)
Sets path to client SSL certificate/key PEM filesFeedClientBuilder
setCertificate(X509Certificate certificate, PrivateKey privateKey)
Sets client SSL certificate/keyFeedClientBuilder
setCertificate(Collection<X509Certificate> certificate, PrivateKey privateKey)
Sets client SSL certificates/keyFeedClientBuilder
setCircuitBreaker(FeedClient.CircuitBreaker breaker)
Overrides default circuit breaker.FeedClientBuilder
setConnectionsPerEndpoint(int max)
Sets the number of connections this client will use per endpoint.FeedClientBuilder
setDryrun(boolean enabled)
FeedClientBuilder
setEndpointUris(List<URI> endpoints)
Overrides endpoint URIs for this clientFeedClientBuilder
setHostnameVerifier(HostnameVerifier verifier)
SetsHostnameVerifier
instance (e.g for disabling default SSL hostname verification).FeedClientBuilder
setMaxStreamPerConnection(int max)
Sets the maximum number of streams per HTTP/2 connection for this client.FeedClientBuilder
setRetryStrategy(FeedClient.RetryStrategy strategy)
Overrides default retry strategy.FeedClientBuilder
setSslContext(SSLContext context)
SetsSSLContext
instance.
-
-
-
Method Detail
-
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
-
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 ismaxConnections * 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)
SetsSSLContext
instance.
-
setHostnameVerifier
FeedClientBuilder setHostnameVerifier(HostnameVerifier verifier)
SetsHostnameVerifier
instance (e.g for disabling default SSL hostname verification).
-
noBenchmarking
FeedClientBuilder noBenchmarking()
Turns off benchmarking. Attempting to getFeedClient.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. ValueSupplier
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:
FeedClient.RetryStrategy
-
setCircuitBreaker
FeedClientBuilder setCircuitBreaker(FeedClient.CircuitBreaker breaker)
Overrides default circuit breaker.- See Also:
FeedClient.CircuitBreaker
-
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)
-
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
-
build
FeedClient build()
Constructs instance ofFeedClient
from builder configuration
-
-