Class HealthCheckedEndpointGroup
java.lang.Object
com.linecorp.armeria.common.util.AbstractListenable<List<Endpoint>>
com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
com.linecorp.armeria.client.endpoint.healthcheck.HealthCheckedEndpointGroup
- All Implemented Interfaces:
EndpointGroup
,EndpointSelector
,AsyncCloseable
,Listenable<List<Endpoint>>
,ListenableAsyncCloseable
,AutoCloseable
An
EndpointGroup
that filters out unhealthy Endpoint
s 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();
-
Method Summary
Modifier and TypeMethodDescriptionbuilder(EndpointGroup delegate, String path)
Returns a newly createdHealthCheckedEndpointGroupBuilder
that builds aHealthCheckedEndpointGroup
which sends HTTPHEAD
health check requests.protected void
doCloseAsync(CompletableFuture<?> future)
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.newMeterBinder(MeterIdPrefix idPrefix)
Returns a newly-createdMeterBinder
which binds the stats about thisHealthCheckedEndpointGroup
.newMeterBinder(String groupName)
Returns a newly-createdMeterBinder
which binds the stats about thisHealthCheckedEndpointGroup
with the default meter names.static HealthCheckedEndpointGroup
of(EndpointGroup delegate, String path)
Returns a newly createdHealthCheckedEndpointGroup
that sends HTTPHEAD
health check requests with default options.toString()
Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
addEndpoint, close, closeAsync, endpoints, isClosed, isClosing, removeEndpoint, select, selectionStrategy, selectNow, setEndpoints, whenClosed, whenReady
Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable
addListener, notifyListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.endpoint.EndpointGroup
addListener, orElse, removeListener
-
Method Details
-
of
Returns a newly createdHealthCheckedEndpointGroup
that sends HTTPHEAD
health check requests with default options.- Parameters:
delegate
- theEndpointGroup
that provides the candidateEndpoint
spath
- the HTTP request path, e.g."/internal/l7check"
-
builder
Returns a newly createdHealthCheckedEndpointGroupBuilder
that builds aHealthCheckedEndpointGroup
which sends HTTPHEAD
health check requests.- Parameters:
delegate
- theEndpointGroup
that provides the candidateEndpoint
spath
- the HTTP request path, e.g."/internal/l7check"
-
doCloseAsync
Description copied from class:DynamicEndpointGroup
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.- Overrides:
doCloseAsync
in classDynamicEndpointGroup
-
newMeterBinder
Returns a newly-createdMeterBinder
which binds the stats about thisHealthCheckedEndpointGroup
with the default meter names. -
newMeterBinder
Returns a newly-createdMeterBinder
which binds the stats about thisHealthCheckedEndpointGroup
. -
toString
-