Interface HostProvider<T extends HostProvider<T>>
public interface HostProvider<T extends HostProvider<T>>
Infrastructure helper class aware of hosts within the cluster and the health of those allowing easy selection of
active ones.
- Since:
- 3.2
- Author:
- Christoph Strobl, Mark Paluch, Peter-Josef Meisch
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classValue object accumulating information about an Elasticsearch cluster.static enumHostProvider.Verificationallows to influence the lookup strategy for active hosts. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<HostProvider.ClusterInformation>Obtain information about known cluster nodes.createWebClient(InetSocketAddress endpoint) default reactor.core.publisher.Mono<WebClient>Get theWebClientconnecting to an active host utilizing cachedElasticsearchHost.default reactor.core.publisher.Mono<WebClient>getActive(HostProvider.Verification verification) Get theWebClientconnecting to an active host.default reactor.core.publisher.Mono<WebClient>Get theWebClientconnecting to an active host utilizing cachedElasticsearchHost.default reactor.core.publisher.Mono<WebClient>getWebClient(HostProvider.Verification verification) Get theWebClientconnecting to an active host.default reactor.core.publisher.Mono<InetSocketAddress>Lookup an active host inlazymode utilizing cachedElasticsearchHost.reactor.core.publisher.Mono<InetSocketAddress>lookupActiveHost(HostProvider.Verification verification) Lookup an active host in using the givenHostProvider.Verification.static HostProvider<?>provider(WebClientProvider clientProvider, Supplier<HttpHeaders> headersSupplier, InetSocketAddress... endpoints) Create a newHostProviderbest suited for the givenWebClientProviderand number of hosts.
-
Method Details
-
provider
static HostProvider<?> provider(WebClientProvider clientProvider, Supplier<HttpHeaders> headersSupplier, InetSocketAddress... endpoints) Create a newHostProviderbest suited for the givenWebClientProviderand number of hosts.- Parameters:
clientProvider- must not be null .headersSupplier- to supply custom headers, must not be nullendpoints- must not be null nor empty.- Returns:
- new instance of
HostProvider.
-
lookupActiveHost
Lookup an active host inlazymode utilizing cachedElasticsearchHost.- Returns:
- the
Monoemitting the active host oran errorif none found.
-
lookupActiveHost
reactor.core.publisher.Mono<InetSocketAddress> lookupActiveHost(HostProvider.Verification verification) Lookup an active host in using the givenHostProvider.Verification.- Parameters:
verification-- Returns:
- the
Monoemitting the active host oran error(NoReachableHostException) if none found.
-
getActive
Get theWebClientconnecting to an active host utilizing cachedElasticsearchHost.- Returns:
- the
Monoemitting the client for an active host oran errorif none found.
-
getActive
Get theWebClientconnecting to an active host.- Parameters:
verification- must not be null.- Returns:
- the
Monoemitting the client for an active host oran errorif none found.
-
getWebClient
Get theWebClientconnecting to an active host utilizing cachedElasticsearchHost.- Returns:
- the
Monoemitting the client for an active host oran errorif none found. - Since:
- 4.4
-
getWebClient
Get theWebClientconnecting to an active host.- Parameters:
verification- must not be null.- Returns:
- the
Monoemitting the client for an active host oran errorif none found. - Since:
- 4.4
-
createWebClient
- Parameters:
endpoint- must not be null.- Returns:
- a
WebClientusing the the given endpoint as transport url.
-
clusterInfo
reactor.core.publisher.Mono<HostProvider.ClusterInformation> clusterInfo()Obtain information about known cluster nodes.- Returns:
- the
MonoemittingHostProvider.ClusterInformationwhen available.
-