ConsumerNetworkClient

ConsumerNetworkClient is a high-level Kafka consumer that…​FIXME

ConsumerNetworkClient is created for KafkaConsumer and AdminClient.

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

pendingCompletion

unsent

UnsentRequests with pending requests per node that have not been sent yet (i.e. awaiting transmission).

Tip

Enable DEBUG logging level for org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient=DEBUG

Refer to Logging.

checkDisconnects Internal Method

void checkDisconnects(long now)

checkDisconnects…​FIXME

Note
checkDisconnects is used exclusively when ConsumerNetworkClient is requested to poll.

"Sending" Request to Broker — send Method

RequestFuture<ClientResponse> send(Node node, AbstractRequest.Builder<?> requestBuilder)

send creates a RequestFutureCompletionHandler and requests the KafkaClient for a new ClientRequest (with the RequestFutureCompletionHandler and expecting a response).

send records the new ClientRequest with the node in unsent internal registry.

send requests the KafkaClient to wake up.

Note
send is used…​FIXME

wakeup Method

void wakeup()

wakeup prints out the following DEBUG message to the logs:

Received user wakeup

wakeup turns the internal wakeup flag on and requests KafkaClient to wakeup

Note
wakeup is used when…​FIXME

Ensuring Fresh Metadata (and Possibly Blocking Until It Refreshes) — ensureFreshMetadata Method

void ensureFreshMetadata()

ensureFreshMetadata waits for metadata update when Metadata was requested for update or time to the next update is now.

Note
ensureFreshMetadata is used when ConsumerCoordinator does onJoinComplete, performAssignment and poll.

pendingRequestCount Method

Caution
FIXME

leastLoadedNode Method

Caution
FIXME

poll Method

void poll(long timeout)
void poll(long timeout, long now, PollCondition pollCondition)
void poll(long timeout, long now, PollCondition pollCondition, boolean disableWakeup)
void poll(RequestFuture<?> future)
boolean poll(RequestFuture<?> future, long timeout)

poll…​FIXME

Note

poll is used when:

Waiting for Metadata Update — awaitMetadataUpdate Method

boolean awaitMetadataUpdate(long timeout)

awaitMetadataUpdate…​FIXME

Note
awaitMetadataUpdate is used when…​FIXME

awaitPendingRequests Method

Caution
FIXME

pollNoWakeup Method

void pollNoWakeup()

pollNoWakeup…​FIXME

Note

pollNoWakeup is used when:

  • KafkaConsumer polls

  • AbstractCoordinator does maybeLeaveGroup

  • HeartbeatThread runs

  • ConsumerCoordinator does commitOffsetsAsync

Creating ConsumerNetworkClient Instance

ConsumerNetworkClient takes the following when created:

ConsumerNetworkClient initializes the internal registries and counters.

results matching ""

    No results matching ""