Class DnsAddressEndpointGroup
- java.lang.Object
-
- com.linecorp.armeria.common.util.AbstractListenable<List<Endpoint>>
-
- com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
-
- com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroup
-
- All Implemented Interfaces:
EndpointGroup
,Listenable<List<Endpoint>>
,SafeCloseable
,AutoCloseable
public final class DnsAddressEndpointGroup extends DynamicEndpointGroup
DynamicEndpointGroup
which resolves targets using DNS address queries (A
andAAAA
). This is useful for environments where service discovery is handled using DNS, e.g. Kubernetes DNS-based service discovery.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Stops polling DNS servers for service updates.static DnsAddressEndpointGroup
of(String hostname)
Creates aDnsAddressEndpointGroup
with an unspecified port that schedules queries on a randomEventLoop
fromCommonPools.workerGroup()
.static DnsAddressEndpointGroup
of(String hostname, int port)
Creates aDnsAddressEndpointGroup
that schedules queries on a randomEventLoop
fromCommonPools.workerGroup()
.-
Methods inherited from class com.linecorp.armeria.client.endpoint.DynamicEndpointGroup
addEndpoint, endpoints, initialEndpointsFuture, removeEndpoint, setEndpoints
-
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, awaitInitialEndpoints, awaitInitialEndpoints, orElse, removeListener
-
-
-
-
Method Detail
-
of
public static DnsAddressEndpointGroup of(String hostname)
Creates aDnsAddressEndpointGroup
with an unspecified port that schedules queries on a randomEventLoop
fromCommonPools.workerGroup()
.- Parameters:
hostname
- the hostname to query DNS queries for
-
of
public static DnsAddressEndpointGroup of(String hostname, int port)
Creates aDnsAddressEndpointGroup
that schedules queries on a randomEventLoop
fromCommonPools.workerGroup()
.- Parameters:
hostname
- the hostname to query DNS queries forport
- the port of theEndpoint
s
-
close
public final void close()
Stops polling DNS servers for service updates.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceEndpointGroup
- Specified by:
close
in interfaceSafeCloseable
- Overrides:
close
in classDynamicEndpointGroup
-
-