Class ConsulEndpointGroup
java.lang.Object
com.linecorp.armeria.common.util.AbstractListenable<List<Endpoint>>
com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
com.linecorp.armeria.client.consul.ConsulEndpointGroup
- All Implemented Interfaces:
EndpointGroup
,EndpointSelector
,AsyncCloseable
,Listenable<List<Endpoint>>
,ListenableAsyncCloseable
,AutoCloseable
@UnstableApi public final class ConsulEndpointGroup extends DynamicEndpointGroup
A Consul-based
EndpointGroup
implementation that retrieves the list of Endpoint
s
from Consul using Consul's HTTP API and updates the
Endpoint
s periodically.-
Method Summary
Modifier and Type Method Description static ConsulEndpointGroupBuilder
builder(URI consulUri, String serviceName)
Returns a newly-createdConsulEndpointGroupBuilder
with the specifiedconsulUri
andserviceName
to buildConsulEndpointGroupBuilder
.protected void
doCloseAsync(CompletableFuture<?> future)
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.static ConsulEndpointGroup
of(URI consulUri, String serviceName)
Returns aConsulEndpointGroup
with the specifiedserviceName
.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, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.endpoint.EndpointGroup
addListener, orElse, removeListener
-
Method Details
-
of
Returns aConsulEndpointGroup
with the specifiedserviceName
. The returnedConsulEndpointGroup
will retrieve the list ofEndpoint
s from a local Consul agent at the default Consul service port.- Parameters:
consulUri
- the URI of Consul API serviceserviceName
- the service name to register
-
builder
Returns a newly-createdConsulEndpointGroupBuilder
with the specifiedconsulUri
andserviceName
to buildConsulEndpointGroupBuilder
.- Parameters:
consulUri
- the URI of Consul API serviceserviceName
- the service name to register
-
doCloseAsync
Description copied from class:DynamicEndpointGroup
Override this method to release the resources held by thisEndpointGroup
and complete the specifiedCompletableFuture
.- Overrides:
doCloseAsync
in classDynamicEndpointGroup
-