DefaultMetadataUpdater

DefaultMetadataUpdater is a MetadataUpdater that NetworkClient uses to…​FIXME

DefaultMetadataUpdater is created when…​FIXME

Table 1. DefaultMetadataUpdater’s Internal Properties (e.g. Registries and Counters)
Name Description

metadata

Metadata

metadataFetchInProgress

Flag to control whether a cluster metadata update is in progress, i.e. FIXME

Tip

Enable WARN, DEBUG or TRACE logging levels for org.apache.kafka.clients.NetworkClient logger to see what happens inside.

Add the following line to config/tools-log4j.properties (for Kafka tools):

log4j.logger.org.apache.kafka.clients.NetworkClient=DEBUG

Add the following line to config/log4j.properties:

log4j.logger.org.apache.kafka.clients.NetworkClient=DEBUG

Refer to Logging.

Creating DefaultMetadataUpdater Instance

DefaultMetadataUpdater takes the following when created:

  • FIXME

DefaultMetadataUpdater initializes the internal registries and counters.

isUpdateDue Method

Caution
FIXME

maybeUpdate Internal Method (with timestamp only)

maybeUpdate(long now)
Note
maybeUpdate is a part of MetadataUpdater Contract.

maybeUpdate requests Metadata for timeToNextUpdate (with the input now).

maybeUpdate takes requestTimeoutMs for the time to wait till metadata fetch in progress finishes if metadataFetchInProgress flag is turned on or 0 otherwise.

maybeUpdate takes the maximum of the two values above to check if the current cluster metadata has expired.

If not, maybeUpdate gives the maximum value (that says how long to wait till the current cluster metadata expires).

Otherwise, maybeUpdate selects the node to request a cluster metadata from and maybeUpdate (with the input now timestamp and the node).

If no node was found, maybeUpdate prints out the following DEBUG message to the logs and gives reconnectBackoffMs.

Give up sending metadata request since no node is available

maybeUpdate Internal Method (with timestamp and node)

long maybeUpdate(long now, Node node)

maybeUpdate…​FIXME

Note
maybeUpdate is used exclusively when DefaultMetadataUpdater is requested to maybeUpdate (with the timestamp only).

handleAuthenticationFailure Callback Method

void handleAuthenticationFailure(AuthenticationException exception)
Note
handleAuthenticationFailure is a part of MetadataUpdater Contract.

handleCompletedMetadataResponse turns metadataFetchInProgress flag off.

handleCompletedMetadataResponse asks Metadata whether metadata update was requested and if so requests it to record a failure (passing on the exception).

handleCompletedMetadataResponse Callback Method

void handleCompletedMetadataResponse(RequestHeader requestHeader, long now, MetadataResponse response)
Note
handleCompletedMetadataResponse is a part of MetadataUpdater Contract.

handleCompletedMetadataResponse turns metadataFetchInProgress flag off.

handleCompletedMetadataResponse takes the cluster from the response.

handleCompletedMetadataResponse requests Metadata to update (with the cluster and unavailable topics) when there is at least one node in the cluster.

When there are no nodes in the cluster, handleCompletedMetadataResponse prints out the following TRACE message to the logs and requests Metadata to record a failure (with no exception).

Ignoring empty metadata response with correlation id [correlationId].

In case response has errors, handleCompletedMetadataResponse prints out the following WARN message to the logs:

Error while fetching metadata with correlation id [correlationId] : [errors]"

results matching ""

    No results matching ""