Class DnsServiceEndpointGroupBuilder
- All Implemented Interfaces:
DynamicEndpointGroupSetters
DnsServiceEndpointGroup
that sources its Endpoint
list from the SRV
DNS records of a certain hostname.-
Method Summary
Modifier and TypeMethodDescriptionaddDnsQueryListeners
(DnsQueryListener... dnsQueryListeners) Adds theDnsQueryListener
that listens to the result ofDnsRecord
queries.addDnsQueryListeners
(Iterable<? extends DnsQueryListener> dnsQueryListeners) Adds theDnsQueryListener
s which listens to the result ofDnsRecord
queries.allowEmptyEndpoints
(boolean allowEmptyEndpoints) Sets whether to allow an emptyEndpoint
list.Sets theBackoff
that determines how much delay should be inserted between queries when a DNS server sent an error response.build()
Returns a newly createdDnsServiceEndpointGroup
.Sets the Caffeine specification string of the cache that stores the domain names and their resolved addresses.decodeIdn
(boolean decodeIdn) Sets if the domain and host names should be decoded to unicode when received.Deprecated.dnsQueryLifecycleObserverFactory
(DnsQueryLifecycleObserverFactory observerFactory) Sets theDnsQueryLifecycleObserverFactory
that is used to generate objects which can observe individual DNS queries.dnsServerAddressStreamProvider
(DnsServerAddressStreamProvider dnsServerAddressStreamProvider) Deprecated.enableDnsQueryMetrics
(boolean enable) Enables the defaultDnsQueryLifecycleObserverFactory
that collects DNS query metrics throughMeterRegistry
.Sets theEventLoop
to use for sending DNS queries.hostsFileEntriesResolver
(HostsFileEntriesResolver hostsFileEntriesResolver) Sets theHostsFileEntriesResolver
which is used to first check if the hostname is locally aliased.maxPayloadSize
(int maxPayloadSize) Sets the capacity of the datagram packet buffer in bytes.maxQueriesPerResolve
(int maxQueriesPerResolve) Sets the base value of maximum allowed number of DNS queries to send when resolving a host name.meterRegistry
(MeterRegistry meterRegistry) SetsMeterRegistry
to collect the DNS query metrics.ndots
(int ndots) Sets the number of dots which must appear in a name before an initial absolute query is made.negativeTtl
(int negativeTtl) Sets the TTL of the cache for the failed DNS queries in seconds.optResourceEnabled
(boolean optResourceEnabled) Enables the automatic inclusion of an optional records that tries to give the remote DNS server a hint about how much data the resolver can read per response.queryTimeout
(Duration queryTimeout) Sets the timeout of the DNS query performed by this resolver.queryTimeoutForEachAttempt
(Duration queryTimeoutForEachAttempt) Sets the timeout of each DNS query performed by this endpoint group.queryTimeoutMillis
(long queryTimeoutMillis) Sets the timeout of the DNS query performed by this resolver in milliseconds.queryTimeoutMillisForEachAttempt
(long queryTimeoutMillisForEachAttempt) Sets the timeout of each DNS query performed by this endpoint group in milliseconds.recursionDesired
(boolean recursionDesired) Sets if this resolver has to send a DNS query with the RD (recursion desired) flag set.searchDomains
(Iterable<String> searchDomains) Sets the list of search domains of the resolver.searchDomains
(String... searchDomains) Sets the search domains of the resolver.selectionStrategy
(EndpointSelectionStrategy selectionStrategy) Sets theEndpointSelectionStrategy
that determines the enumeration order ofEndpoint
s.selectionTimeout
(Duration selectionTimeout) Sets the timeout to wait until a successfulEndpoint
selection.selectionTimeoutMillis
(long selectionTimeoutMillis) Sets the timeout to wait until a successfulEndpoint
selection.serverAddresses
(Iterable<InetSocketAddress> serverAddresses) Sets the DNS server addresses to send queries to.serverAddresses
(InetSocketAddress... serverAddresses) Sets the DNS server addresses to send queries to.serverAddressStreamProvider
(DnsServerAddressStreamProvider serverAddressStreamProvider) Sets theDnsServerAddressStreamProvider
which is used to determine which DNS server is used to resolve each hostname.traceEnabled
(boolean traceEnabled) Sets if this resolver should generate detailed trace information in exception messages so that it is easier to understand the cause of resolution failure.ttl
(int minTtl, int maxTtl) Sets the minimum and maximum TTL of the cached DNS resource records in seconds.Methods inherited from class com.linecorp.armeria.client.AbstractDnsResolverBuilder
buildConfigurator, cacheSpec, hostsFileEntriesResolver, maxTtl, maybeCreateDnsCache, meterRegistry, minTtl, ndots, negativeTtl, queryTimeoutMillis, searchDomains, serverAddressStreamProvider
-
Method Details
-
build
Returns a newly createdDnsServiceEndpointGroup
. -
eventLoop
Sets theEventLoop
to use for sending DNS queries. -
backoff
Sets theBackoff
that determines how much delay should be inserted between queries when a DNS server sent an error response.Backoff.exponential(1000, 32000).withJitter(0.2)
is used by default. -
selectionStrategy
public DnsServiceEndpointGroupBuilder selectionStrategy(EndpointSelectionStrategy selectionStrategy) Sets theEndpointSelectionStrategy
that determines the enumeration order ofEndpoint
s. -
traceEnabled
Description copied from class:AbstractDnsResolverBuilder
Sets if this resolver should generate detailed trace information in exception messages so that it is easier to understand the cause of resolution failure. This flag is enabled by default.- Overrides:
traceEnabled
in classAbstractDnsResolverBuilder
-
queryTimeout
Description copied from class:AbstractDnsResolverBuilder
Sets the timeout of the DNS query performed by this resolver.0
disables the timeout. If unspecified, 5000 ms will be used.- Overrides:
queryTimeout
in classAbstractDnsResolverBuilder
-
queryTimeoutMillis
Description copied from class:AbstractDnsResolverBuilder
Sets the timeout of the DNS query performed by this resolver in milliseconds.0
disables the timeout. If unspecified, 5000 ms will be used.- Overrides:
queryTimeoutMillis
in classAbstractDnsResolverBuilder
-
queryTimeoutForEachAttempt
public DnsServiceEndpointGroupBuilder queryTimeoutForEachAttempt(Duration queryTimeoutForEachAttempt) Description copied from class:AbstractDnsResolverBuilder
Sets the timeout of each DNS query performed by this endpoint group. This option is useful if you want to set a timeout for each search domain resolution. If unspecified, the value ofAbstractDnsResolverBuilder.queryTimeout(Duration)
is used.- Overrides:
queryTimeoutForEachAttempt
in classAbstractDnsResolverBuilder
-
queryTimeoutMillisForEachAttempt
public DnsServiceEndpointGroupBuilder queryTimeoutMillisForEachAttempt(long queryTimeoutMillisForEachAttempt) Description copied from class:AbstractDnsResolverBuilder
Sets the timeout of each DNS query performed by this endpoint group in milliseconds. This option is useful if you want to set a timeout for each search domain resolution. If unspecified, the value ofAbstractDnsResolverBuilder.queryTimeoutMillis(long)
is used.- Overrides:
queryTimeoutMillisForEachAttempt
in classAbstractDnsResolverBuilder
-
recursionDesired
Description copied from class:AbstractDnsResolverBuilder
Sets if this resolver has to send a DNS query with the RD (recursion desired) flag set. This flag is enabled by default.- Overrides:
recursionDesired
in classAbstractDnsResolverBuilder
-
maxQueriesPerResolve
Description copied from class:AbstractDnsResolverBuilder
Sets the base value of maximum allowed number of DNS queries to send when resolving a host name. The actual maximum allowed number of queries will be multiplied by theDnsServerAddressStream.size()
. For example, ifmaxQueriesPerResolve
is 5 andDnsServerAddressStream.size()
is 2, DNS queries can be executed up to 10 times. TheDnsServerAddressStream
is provided byDnsServerAddressStreamProvider
. -
serverAddresses
Description copied from class:AbstractDnsResolverBuilder
Sets the DNS server addresses to send queries to. Operating system default is used by default.- Overrides:
serverAddresses
in classAbstractDnsResolverBuilder
-
serverAddresses
Description copied from class:AbstractDnsResolverBuilder
Sets the DNS server addresses to send queries to. Operating system default is used by default.- Overrides:
serverAddresses
in classAbstractDnsResolverBuilder
-
serverAddressStreamProvider
public DnsServiceEndpointGroupBuilder serverAddressStreamProvider(DnsServerAddressStreamProvider serverAddressStreamProvider) Description copied from class:AbstractDnsResolverBuilder
Sets theDnsServerAddressStreamProvider
which is used to determine which DNS server is used to resolve each hostname.- Overrides:
serverAddressStreamProvider
in classAbstractDnsResolverBuilder
-
dnsServerAddressStreamProvider
@Deprecated public DnsServiceEndpointGroupBuilder dnsServerAddressStreamProvider(DnsServerAddressStreamProvider dnsServerAddressStreamProvider) Deprecated.Description copied from class:AbstractDnsResolverBuilder
Sets theDnsServerAddressStreamProvider
which is used to determine which DNS server is used to resolve each hostname.- Overrides:
dnsServerAddressStreamProvider
in classAbstractDnsResolverBuilder
-
maxPayloadSize
Description copied from class:AbstractDnsResolverBuilder
Sets the capacity of the datagram packet buffer in bytes.- Overrides:
maxPayloadSize
in classAbstractDnsResolverBuilder
-
optResourceEnabled
Description copied from class:AbstractDnsResolverBuilder
Enables the automatic inclusion of an optional records that tries to give the remote DNS server a hint about how much data the resolver can read per response. Some DNS Server may not support this and so fail to answer queries.- Overrides:
optResourceEnabled
in classAbstractDnsResolverBuilder
-
hostsFileEntriesResolver
public DnsServiceEndpointGroupBuilder hostsFileEntriesResolver(HostsFileEntriesResolver hostsFileEntriesResolver) Description copied from class:AbstractDnsResolverBuilder
Sets theHostsFileEntriesResolver
which is used to first check if the hostname is locally aliased.- Overrides:
hostsFileEntriesResolver
in classAbstractDnsResolverBuilder
-
dnsQueryLifecycleObserverFactory
public DnsServiceEndpointGroupBuilder dnsQueryLifecycleObserverFactory(DnsQueryLifecycleObserverFactory observerFactory) Description copied from class:AbstractDnsResolverBuilder
Sets theDnsQueryLifecycleObserverFactory
that is used to generate objects which can observe individual DNS queries.- Overrides:
dnsQueryLifecycleObserverFactory
in classAbstractDnsResolverBuilder
-
disableDnsQueryMetrics
Deprecated.Description copied from class:AbstractDnsResolverBuilder
Disables the defaultDnsQueryLifecycleObserverFactory
that collects DNS query metrics throughMeterRegistry
.- Overrides:
disableDnsQueryMetrics
in classAbstractDnsResolverBuilder
-
enableDnsQueryMetrics
Description copied from class:AbstractDnsResolverBuilder
Enables the defaultDnsQueryLifecycleObserverFactory
that collects DNS query metrics throughMeterRegistry
. This option is enabled by default.- Overrides:
enableDnsQueryMetrics
in classAbstractDnsResolverBuilder
-
searchDomains
Description copied from class:AbstractDnsResolverBuilder
Sets the search domains of the resolver.- Overrides:
searchDomains
in classAbstractDnsResolverBuilder
-
searchDomains
Description copied from class:AbstractDnsResolverBuilder
Sets the list of search domains of the resolver.- Overrides:
searchDomains
in classAbstractDnsResolverBuilder
-
ndots
Description copied from class:AbstractDnsResolverBuilder
Sets the number of dots which must appear in a name before an initial absolute query is made.- Overrides:
ndots
in classAbstractDnsResolverBuilder
-
decodeIdn
Description copied from class:AbstractDnsResolverBuilder
Sets if the domain and host names should be decoded to unicode when received. See rfc3492. This flag is enabled by default.- Overrides:
decodeIdn
in classAbstractDnsResolverBuilder
-
meterRegistry
Description copied from class:AbstractDnsResolverBuilder
SetsMeterRegistry
to collect the DNS query metrics.- Overrides:
meterRegistry
in classAbstractDnsResolverBuilder
-
cacheSpec
Description copied from class:AbstractDnsResolverBuilder
Sets the Caffeine specification string of the cache that stores the domain names and their resolved addresses. If not set,Flags.dnsCacheSpec()
is used by default.Note that
AbstractDnsResolverBuilder.cacheSpec(String)
andAbstractDnsResolverBuilder.dnsCache(DnsCache)
are mutually exclusive.- Overrides:
cacheSpec
in classAbstractDnsResolverBuilder
-
ttl
Description copied from class:AbstractDnsResolverBuilder
Sets the minimum and maximum TTL of the cached DNS resource records in seconds. If the TTL of the DNS resource record returned by the DNS server is less than the minimum TTL or greater than the maximum TTL, this resolver will ignore the TTL from the DNS server and use the minimum TTL or the maximum TTL instead respectively. The default value is1
andInteger.MAX_VALUE
, which practically tells this resolver to respect the TTL from the DNS server.Note that
AbstractDnsResolverBuilder.ttl(int, int)
andAbstractDnsResolverBuilder.dnsCache(DnsCache)
are mutually exclusive.- Overrides:
ttl
in classAbstractDnsResolverBuilder
-
negativeTtl
Description copied from class:AbstractDnsResolverBuilder
Sets the TTL of the cache for the failed DNS queries in seconds. The default value is0
which means that the DNS resolver does not cache when DNS queries are failed.Note that
AbstractDnsResolverBuilder.negativeTtl(int)
andAbstractDnsResolverBuilder.dnsCache(DnsCache)
are mutually exclusive.- Overrides:
negativeTtl
in classAbstractDnsResolverBuilder
-
dnsCache
Description copied from class:AbstractDnsResolverBuilder
Sets theDnsCache
that caches the resolvedDnsRecord
s and the cause of a failure if negative cache is activated. This option is useful if you want to share aDnsCache
with multiple DNS resolvers. If unspecified, the defaultDnsCache
is used.Note that if
AbstractDnsResolverBuilder.cacheSpec(String)
,AbstractDnsResolverBuilder.ttl(int, int)
, orAbstractDnsResolverBuilder.negativeTtl(int)
is set, the DNS resolver will create its ownDnsCache
using the properties. Therefore,AbstractDnsResolverBuilder.cacheSpec(String)
,AbstractDnsResolverBuilder.ttl(int, int)
, andAbstractDnsResolverBuilder.negativeTtl(int)
are mutually exclusive withAbstractDnsResolverBuilder.dnsCache(DnsCache)
.- Overrides:
dnsCache
in classAbstractDnsResolverBuilder
-
allowEmptyEndpoints
Description copied from interface:DynamicEndpointGroupSetters
- Specified by:
allowEmptyEndpoints
in interfaceDynamicEndpointGroupSetters
-
selectionTimeout
Description copied from interface:DynamicEndpointGroupSetters
Sets the timeout to wait until a successfulEndpoint
selection.Duration.ZERO
disables the timeout. If unspecified,Flags.defaultConnectTimeoutMillis()
is used by default.- Specified by:
selectionTimeout
in interfaceDynamicEndpointGroupSetters
-
selectionTimeoutMillis
Sets the timeout to wait until a successfulEndpoint
selection.0
disables the timeout. If unspecified, the default DNS query timeout (DnsUtil.DEFAULT_DNS_QUERY_TIMEOUT_MILLIS
ms) is used by default.- Specified by:
selectionTimeoutMillis
in interfaceDynamicEndpointGroupSetters
-
addDnsQueryListeners
public DnsServiceEndpointGroupBuilder addDnsQueryListeners(Iterable<? extends DnsQueryListener> dnsQueryListeners) Adds theDnsQueryListener
s which listens to the result ofDnsRecord
queries. If noDnsQueryListener
is configured,DnsQueryListener.of()
is used by default. -
addDnsQueryListeners
Adds theDnsQueryListener
that listens to the result ofDnsRecord
queries. If noDnsQueryListener
is configured,DnsQueryListener.of()
is used by default.
-