U - the type of address before resolution (unresolved address)R - the type of address after resolution (resolved address)public interface PartitionedHttpClientBuilder<U,R>
StreamingHttpClient instances which call the server associated with a partition
selected from a set of PartitionedServiceDiscovererEvents resolved from a single unresolved address.
Partition selection uses a function to infer PartitionAttributes from the HttpRequestMetaData.
It also provides a good set of default settings and configurations, which could be used by most users as-is or
could be overridden to address specific use cases.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
PartitionedHttpClientBuilder.SingleAddressInitializer<U,R>
Initializes the
SingleAddressHttpClientBuilder for each new client. |
| Modifier and Type | Method and Description |
|---|---|
PartitionedHttpClientBuilder<U,R> |
bufferAllocator(BufferAllocator allocator)
Sets the
BufferAllocator for all connections created from this builder. |
default HttpClient |
build()
Builds a new
HttpClient. |
default BlockingHttpClient |
buildBlocking()
Creates a new
BlockingHttpClient. |
default BlockingStreamingHttpClient |
buildBlockingStreaming()
Creates a new
BlockingStreamingHttpClient. |
StreamingHttpClient |
buildStreaming()
Builds a new
StreamingHttpClient. |
PartitionedHttpClientBuilder<U,R> |
executionStrategy(HttpExecutionStrategy strategy)
Sets the
HttpExecutionStrategy for all connections created from this builder. |
PartitionedHttpClientBuilder<U,R> |
executor(Executor executor)
Sets the
Executor for all connections created from this builder. |
PartitionedHttpClientBuilder<U,R> |
initializer(PartitionedHttpClientBuilder.SingleAddressInitializer<U,R> initializer)
Set a function which can customize options for each
StreamingHttpClient that is built. |
PartitionedHttpClientBuilder<U,R> |
ioExecutor(IoExecutor ioExecutor)
Sets the
IoExecutor for all connections created from this builder. |
PartitionedHttpClientBuilder<U,R> |
partitionMapFactory(PartitionMapFactory partitionMapFactory)
Sets
PartitionMapFactory to use by all StreamingHttpClients created by this builder. |
PartitionedHttpClientBuilder<U,R> |
retryServiceDiscoveryErrors(BiIntFunction<Throwable,? extends Completable> retryStrategy)
Sets a retry strategy to retry errors emitted by
ServiceDiscoverer. |
PartitionedHttpClientBuilder<U,R> |
serviceDiscoverer(ServiceDiscoverer<U,R,PartitionedServiceDiscovererEvent<R>> serviceDiscoverer)
Sets a
ServiceDiscoverer to resolve addresses of remote servers to connect to. |
PartitionedHttpClientBuilder<U,R> |
serviceDiscoveryMaxQueueSize(int serviceDiscoveryMaxQueueSize)
Sets the maximum amount of
ServiceDiscovererEvent objects that will be queued for each partition. |
PartitionedHttpClientBuilder<U,R> ioExecutor(IoExecutor ioExecutor)
IoExecutor for all connections created from this builder.ioExecutor - IoExecutor to use.this.PartitionedHttpClientBuilder<U,R> executor(Executor executor)
Executor for all connections created from this builder.executor - IoExecutor to use.this.PartitionedHttpClientBuilder<U,R> executionStrategy(HttpExecutionStrategy strategy)
HttpExecutionStrategy for all connections created from this builder.strategy - HttpExecutionStrategy to use.this.HttpExecutionStrategiesPartitionedHttpClientBuilder<U,R> bufferAllocator(BufferAllocator allocator)
BufferAllocator for all connections created from this builder.allocator - BufferAllocator to use.this.PartitionedHttpClientBuilder<U,R> serviceDiscoverer(ServiceDiscoverer<U,R,PartitionedServiceDiscovererEvent<R>> serviceDiscoverer)
ServiceDiscoverer to resolve addresses of remote servers to connect to.serviceDiscoverer - The ServiceDiscoverer to resolve addresses of remote servers to connect to.
Lifecycle of the provided ServiceDiscoverer is managed externally and it should be
closed after all built StreamingHttpClients will be closed and
this ServiceDiscoverer is no longer needed.this.PartitionedHttpClientBuilder<U,R> retryServiceDiscoveryErrors(BiIntFunction<Throwable,? extends Completable> retryStrategy)
ServiceDiscoverer.retryStrategy - a retry strategy to retry errors emitted by ServiceDiscoverer.this.RetryStrategiesPartitionedHttpClientBuilder<U,R> serviceDiscoveryMaxQueueSize(int serviceDiscoveryMaxQueueSize)
ServiceDiscovererEvent objects that will be queued for each partition.
It is assumed that the PublisherSource.Subscribers will process events in a timely manner (typically synchronously)
so this typically doesn't need to be very large.
serviceDiscoveryMaxQueueSize - the maximum amount of ServiceDiscovererEvent objects that will be
queued for each partition.this.PartitionedHttpClientBuilder<U,R> partitionMapFactory(PartitionMapFactory partitionMapFactory)
PartitionMapFactory to use by all StreamingHttpClients created by this builder.partitionMapFactory - PartitionMapFactory to use.this.PartitionedHttpClientBuilder<U,R> initializer(PartitionedHttpClientBuilder.SingleAddressInitializer<U,R> initializer)
StreamingHttpClient that is built.initializer - Initializes the SingleAddressHttpClientBuilder used to build new
StreamingHttpClients.thisStreamingHttpClient buildStreaming()
StreamingHttpClient.StreamingHttpClientIllegalArgumentException - for incomplete or illegal configurationsIllegalStateException - for unsupported configuration combinationsdefault HttpClient build()
HttpClient.HttpClientdefault BlockingStreamingHttpClient buildBlockingStreaming()
BlockingStreamingHttpClient.BlockingStreamingHttpClientdefault BlockingHttpClient buildBlocking()
BlockingHttpClient.BlockingHttpClient