Package ai.vespa.feed.client
Interface FeedClientBuilder
public interface FeedClientBuilder
Builder for creating a
FeedClient
instance.- Author:
- bjorncs, jonmv
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRequestHeader
(String name, String value) Adds HTTP request header to all client requests.addRequestHeader
(String name, Supplier<String> valueSupplier) Adds HTTP request header to all client requests.build()
Constructs instance ofFeedClient
from builder configurationstatic FeedClientBuilder
Creates a builder for a single feed container endpoint.static FeedClientBuilder
Creates a builder which distributes the feed across the given feed container endpoints.Turns off benchmarking.setCaCertificates
(Collection<X509Certificate> caCertificates) Overrides JVM default SSL truststoresetCaCertificatesFile
(Path caCertificatesFile) Overrides JVM default SSL truststoresetCertificate
(Path certificatePemFile, Path privateKeyPemFile) Sets path to client SSL certificate/key PEM filessetCertificate
(X509Certificate certificate, PrivateKey privateKey) Sets client SSL certificate/keysetCertificate
(Collection<X509Certificate> certificate, PrivateKey privateKey) Sets client SSL certificates/keyOverrides default circuit breaker.setCompression
(FeedClientBuilder.Compression compression) What compression to use for request bodies; defaultauto
.setConnectionsPerEndpoint
(int max) Sets the number of connections this client will use per endpoint.setDryrun
(boolean enabled) Turns on dryrun mode, where each operation succeeds after a given delay, rather than being sent across the network.setEndpointUris
(List<URI> endpoints) Overrides endpoint URIs for this clientstatic void
Override FeedClientBuilder.setHostnameVerifier
(HostnameVerifier verifier) SetsHostnameVerifier
instance (e.g for disabling default SSL hostname verification).setMaxStreamPerConnection
(int max) Sets the maximum number of streams per HTTP/2 connection for this client.Specify HTTP(S) proxy for all endpointssetRetryStrategy
(FeedClient.RetryStrategy strategy) Overrides default retry strategy.setSpeedTest
(boolean enabled) Turns on speed test mode, where all feed operations are immediately acknowledged by the server.setSslContext
(SSLContext context) SetsSSLContext
instance.
-
Field Details
-
PREFERRED_IMPLEMENTATION_PROPERTY
- See Also:
-
-
Method Details
-
create
Creates a builder for a single feed container endpoint. This is for feeding against a container cluster with a load balancer in front of it. -
create
Creates a builder which distributes the feed across the given feed container endpoints. This is for feeding directly against container nodes, i.e., when no load balancer sits in front of these. Each feed operation is sent to one of the endpoints, not all of them! -
setFeedClientBuilderSupplier
Override FeedClientBuilder. This will be preferred increate(java.net.URI)
-
setConnectionsPerEndpoint
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
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
SetsSSLContext
instance. -
setHostnameVerifier
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
Adds HTTP request header to all client requests. -
addRequestHeader
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
Overrides default retry strategy.- See Also:
-
setCircuitBreaker
Overrides default circuit breaker.- See Also:
-
setCertificate
Sets path to client SSL certificate/key PEM files -
setCertificate
Sets client SSL certificates/key -
setCertificate
Sets client SSL certificate/key -
setDryrun
Turns on dryrun mode, where each operation succeeds after a given delay, rather than being sent across the network. -
setSpeedTest
Turns on speed test mode, where all feed operations are immediately acknowledged by the server. -
setCaCertificatesFile
Overrides JVM default SSL truststore- Parameters:
caCertificatesFile
- Path to PEM encoded file containing trusted certificates
-
setCaCertificates
Overrides JVM default SSL truststore -
setEndpointUris
Overrides endpoint URIs for this client -
setProxy
Specify HTTP(S) proxy for all endpoints -
setCompression
What compression to use for request bodies; defaultauto
. -
build
FeedClient build()Constructs instance ofFeedClient
from builder configuration
-