Class HealthCheckedEndpointGroup

All Implemented Interfaces:
EndpointGroup, EndpointSelector, AsyncCloseable, Listenable<List<Endpoint>>, ListenableAsyncCloseable, AutoCloseable

public final class HealthCheckedEndpointGroup
extends DynamicEndpointGroup
An EndpointGroup that filters out unhealthy Endpoints from an existing EndpointGroup, by sending periodic health check requests.

 EndpointGroup originalGroup = ...

 // Decorate the EndpointGroup with HealthCheckedEndpointGroup
 // that sends HTTP health check requests to '/internal/l7check' every 10 seconds.
 HealthCheckedEndpointGroup healthCheckedGroup =
         HealthCheckedEndpointGroup.builder(originalGroup, "/internal/l7check")
                                   .protocol(SessionProtocol.HTTP)
                                   .retryInterval(Duration.ofSeconds(10))
                                   .build();

 // You must specify healthCheckedGroup when building a WebClient, otherwise health checking
 // will not be enabled.
 WebClient client = WebClient.builder(SessionProtocol.HTTP, healthCheckedGroup)
                             .build();