public interface DnsServiceDiscovererBuilder
ServiceDiscoverer which will attempt to
resolve A, AAAA, CNAME, and SRV type queries.| Modifier and Type | Method and Description |
|---|---|
ServiceDiscoverer<HostAndPort,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> |
buildARecordDiscoverer()
Build a new
ServiceDiscoverer which targets
host addresses (e.g. |
ServiceDiscoverer<String,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> |
buildSrvDiscoverer()
|
DnsServiceDiscovererBuilder |
dnsResolverAddressTypes(DnsResolverAddressTypes dnsResolverAddressTypes)
Sets the list of the protocol families of the address resolved.
|
DnsServiceDiscovererBuilder |
dnsServerAddressStreamProvider(DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
Set the
DnsServerAddressStreamProvider which determines which DNS server should be used per query. |
DnsServiceDiscovererBuilder |
ioExecutor(IoExecutor ioExecutor)
Sets the
IoExecutor. |
DnsServiceDiscovererBuilder |
maxUdpPayloadSize(int maxUdpPayloadSize)
Set the maximum size of the receiving UDP datagram (in bytes).
|
DnsServiceDiscovererBuilder |
missingRecordStatus(ServiceDiscovererEvent.Status status)
Sets which
ServiceDiscovererEvent.Status to use in ServiceDiscovererEvent.status() when a record
for a previously seen address is missing in the response. |
DnsServiceDiscovererBuilder |
ndots(int ndots)
Set the number of dots which must appear in a name before an initial absolute query is made.
|
DnsServiceDiscovererBuilder |
observer(DnsServiceDiscovererObserver observer)
Sets a
DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builder. |
DnsServiceDiscovererBuilder |
optResourceEnabled(boolean optResourceEnabled)
Enable the automatic inclusion of a optional records that tries to give the remote DNS server a hint about
how much data the resolver can read per response.
|
DnsServiceDiscovererBuilder |
queryTimeout(Duration queryTimeout)
Sets the timeout of each DNS query performed by this service discoverer.
|
DnsServiceDiscovererBuilder |
ttl(int minSeconds,
int maxSeconds)
Controls min/max TTL values that will influence polling intervals.
|
DnsServiceDiscovererBuilder |
ttl(int minSeconds,
int maxSeconds,
int minCacheSeconds,
int maxCacheSeconds)
Controls min/max TTL values that will affect polling intervals and local caching.
|
DnsServiceDiscovererBuilder |
ttlJitter(Duration ttlJitter)
The jitter to apply for scheduling the next query after TTL to help spread out subsequent DNS queries.
|
DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds)
The created ServiceDiscoverer polls DNS server based on TTL value of the resolved records. Min/max values
help to make sure polling stays within reasonable boundaries. Too frequent DNS queries may generate too much load
for the DNS server, too rare DNS queries may lead to incorrect state if the remote servers changed IPs before
original TTL expired.
With this overload, there will be no local caching for resolved records.
minSeconds - The minimum about of time the result will be considered valid (in seconds), must be greater
than 0.maxSeconds - The maximum about of time the result will be considered valid (in seconds), must be greater
than or equal to minSeconds.this.ttl(int, int, int, int)DnsServiceDiscovererBuilder ttl(int minSeconds, int maxSeconds, int minCacheSeconds, int maxCacheSeconds)
The created ServiceDiscoverer polls DNS server based on TTL value of the resolved records. Min/max values
help to make sure polling stays within reasonable boundaries. Too frequent DNS queries may generate too much load
for the DNS server, too rare DNS queries may lead to incorrect state if the remote servers changed IPs before
original TTL expired.
The second min/max pair controls for how long the resolved records should be cached locally. Cache is helpful in scenarios when multiple concurrent resolutions are possible for the same address: either an application runs multiple client instances for the same hostname or clients perform DNS resolutions per new connection instead of background polling.
minSeconds - The minimum about of time the result will be considered valid (in seconds), must be greater
than 0.maxSeconds - The maximum about of time the result will be considered valid (in seconds), must be greater
than or equal to minSeconds.minCacheSeconds - The minimum about of time the result will be cached locally (in seconds), must be greater
than or equal to 0, and less than or equal to minSeconds.maxCacheSeconds - The maximum about of time the result will be cached locally (in seconds), must be greater
than or equal to minCacheSeconds, and less than or equal to maxSeconds.this.ttl(int, int)DnsServiceDiscovererBuilder ttlJitter(Duration ttlJitter)
The jitter value will be added on top of the TTL value returned from the DNS server to avoid hitting the cache.
ttlJitter - The jitter to apply to schedule the next query after TTL.this.DnsServiceDiscovererBuilder dnsServerAddressStreamProvider(@Nullable DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
DnsServerAddressStreamProvider which determines which DNS server should be used per query.dnsServerAddressStreamProvider - the DnsServerAddressStreamProvider which determines which DNS
server should be used per query.this.DnsServiceDiscovererBuilder optResourceEnabled(boolean optResourceEnabled)
optResourceEnabled - if optional records inclusion is enabled.this.DnsServiceDiscovererBuilder maxUdpPayloadSize(int maxUdpPayloadSize)
If the DNS response exceeds this amount the request will be automatically retried via TCP.
maxUdpPayloadSize - the maximum size of the receiving UDP datagram (in bytes)this.DnsServiceDiscovererBuilder ndots(int ndots)
ndots - the ndots value.this.DnsServiceDiscovererBuilder queryTimeout(Duration queryTimeout)
queryTimeout - the query timeout valuethis.DnsServiceDiscovererBuilder dnsResolverAddressTypes(@Nullable DnsResolverAddressTypes dnsResolverAddressTypes)
dnsResolverAddressTypes - the address types or null to use the default value, based on "java.net"
system properties: java.net.preferIPv4Stack and java.net.preferIPv6Stack.this.DnsServiceDiscovererBuilder ioExecutor(IoExecutor ioExecutor)
IoExecutor.ioExecutor - IoExecutor to use.this.DnsServiceDiscovererBuilder observer(DnsServiceDiscovererObserver observer)
DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builder.observer - a DnsServiceDiscovererObserver that provides visibility into
DNS ServiceDiscoverer built by this builderthis.DnsServiceDiscovererBuilder missingRecordStatus(ServiceDiscovererEvent.Status status)
ServiceDiscovererEvent.Status to use in ServiceDiscovererEvent.status() when a record
for a previously seen address is missing in the response.status - a ServiceDiscovererEvent.Status for missing records.this.ServiceDiscoverer<String,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildSrvDiscoverer()
ServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.ServiceDiscoverer which queries
SRV Resource Records corresponding to serviceName. For
each SRV answer capture the Port and resolve the Target.ServiceDiscoverer<HostAndPort,InetSocketAddress,ServiceDiscovererEvent<InetSocketAddress>> buildARecordDiscoverer()
ServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.ServiceDiscoverer which targets
host addresses (e.g. A or AAAA records) and uses
a fixed port derived from the HostAndPort.