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
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 TypeMethodDescriptionstatic ConsulEndpointGroupBuilder
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
.Returns the latest value notified before.static ConsulEndpointGroup
Returns aConsulEndpointGroup
with the specifiedserviceName
.toString()
Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
addEndpoint, allowsEmptyEndpoints, builder, close, closeAsync, endpoints, isClosed, isClosing, removeEndpoint, select, select, selectionStrategy, selectionTimeoutMillis, selectNow, setEndpoints, toString, whenClosed, whenReady
Methods inherited from class com.linecorp.armeria.common.util.AbstractListenable
addListener, 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, 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
-
toString
- Overrides:
toString
in classDynamicEndpointGroup
-
latestValue
Description copied from class:AbstractListenable
Returns the latest value notified before.null
if the value has not been initialized yet or the implementation of this class cannot cache it.- Overrides:
latestValue
in classAbstractListenable<List<Endpoint>>
-