Top Description Methods
io.netty5.resolver.dns

public Interface DnsQueryLifecycleObserver

Known Direct Implementers
io.netty5.resolver.dns.BiDnsQueryLifecycleObserver, io.netty5.resolver.dns.LoggingDnsQueryLifecycleObserver, io.netty5.resolver.dns.NoopDnsQueryLifecycleObserver
Imports
io.netty5.handler.codec.dns.DnsQuestion, .DnsRecordType, .DnsResponseCode, io.netty5.util.concurrent.Future, java.net.InetSocketAddress, java.util.List

This interface provides visibility into individual DNS queries. The lifecycle of an objects is as follows:
  1. Object creation
  2. queryCancelled(int)
OR
  1. Object creation
  2. queryWritten(InetSocketAddress, Future)
  3. queryRedirected(List) or queryCNAMEd(DnsQuestion) or queryNoAnswer(DnsResponseCode) or queryCancelled(int) or queryFailed(Throwable) or querySucceed()

This interface can be used to track metrics for individual DNS servers. Methods which may lead to another DNS query return an object of type DnsQueryLifecycleObserver. Implementations may use this to build a query tree to understand the "sub queries" generated by a single query.

Method Summary

Modifier and TypeMethod and Description
public void
queryCancelled(int
The number of queries remaining.
queriesRemaining
)

The query may have been written but it was cancelled at some point.

public DnsQueryLifecycleObserver

Returns:

An observer for the new query which we may issue.
queryCNAMEd
(DnsQuestion
the question we would use if we issue a new query.
cnameQuestion
)

The query returned a CNAME which we may attempt to follow with a new query.

public void
queryFailed(Throwable
The cause which for the failure.
cause
)

The following criteria are possible:

  • IO Error
  • Server responded with an invalid DNS response
  • Server responded with a valid DNS response, but it didn't progress the resolution
public DnsQueryLifecycleObserver

Returns:

An observer for the new query which we may issue.
queryNoAnswer
(DnsResponseCode
the unexpected response code.
code
)

The response to the query didn't provide the expected response code, but it didn't return DnsResponseCode#NXDOMAIN so we may try to query again.

public DnsQueryLifecycleObserver

Returns:

An observer for the new query which we may issue.
queryRedirected
(List<InetSocketAddress>
The name servers the query has been redirected to.
nameServers
)

The query has been redirected to another list of DNS servers.

public void
querySucceed()

The query received the expected results.

public void
queryWritten(InetSocketAddress
The DNS server address which the query was sent to.
dnsServerAddress
,
Future<Void>
The future which represents the status of the write operation for the DNS query.
future
)

The query has been written.

Method Detail

queryCancelledback to summary
public void queryCancelled(int queriesRemaining)

The query may have been written but it was cancelled at some point.

Parameters
queriesRemaining:int

The number of queries remaining.

queryCNAMEdback to summary
public DnsQueryLifecycleObserver queryCNAMEd(DnsQuestion cnameQuestion)

The query returned a CNAME which we may attempt to follow with a new query.

Note that multiple queries may be encountering a CNAME. For example a if both DnsRecordType#AAAA and DnsRecordType#A are supported we may query for both.

Parameters
cnameQuestion:DnsQuestion

the question we would use if we issue a new query.

Returns:DnsQueryLifecycleObserver

An observer for the new query which we may issue.

queryFailedback to summary
public void queryFailed(Throwable cause)

The following criteria are possible:

  • IO Error
  • Server responded with an invalid DNS response
  • Server responded with a valid DNS response, but it didn't progress the resolution
Parameters
cause:Throwable

The cause which for the failure.

queryNoAnswerback to summary
public DnsQueryLifecycleObserver queryNoAnswer(DnsResponseCode code)

The response to the query didn't provide the expected response code, but it didn't return DnsResponseCode#NXDOMAIN so we may try to query again.

Parameters
code:DnsResponseCode

the unexpected response code.

Returns:DnsQueryLifecycleObserver

An observer for the new query which we may issue.

queryRedirectedback to summary
public DnsQueryLifecycleObserver queryRedirected(List<InetSocketAddress> nameServers)

The query has been redirected to another list of DNS servers.

Parameters
nameServers:List<InetSocketAddress>

The name servers the query has been redirected to.

Returns:DnsQueryLifecycleObserver

An observer for the new query which we may issue.

querySucceedback to summary
public void querySucceed()

The query received the expected results.

queryWrittenback to summary
public void queryWritten(InetSocketAddress dnsServerAddress, Future<Void> future)

The query has been written.

Parameters
dnsServerAddress:InetSocketAddress

The DNS server address which the query was sent to.

future:Future<Void>

The future which represents the status of the write operation for the DNS query.