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 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

int pendingRequestCount()
int pendingRequestCount(Node node)

pendingRequestCount…​FIXME

Note
pendingRequestCount is used when…​FIXME

leastLoadedNode Method

Node leastLoadedNode()

leastLoadedNode…​FIXME

Note

leastLoadedNode is used when:

poll Method

void poll(RequestFuture<?> future)
boolean poll(RequestFuture<?> future, Timer timer)
void poll(Timer timer)
void poll(Timer timer, PollCondition pollCondition)
void poll(Timer timer, PollCondition pollCondition, boolean disableWakeup)

poll…​FIXME

Note

poll is used when…​FIXME

Waiting for Metadata Update — awaitMetadataUpdate Method

boolean awaitMetadataUpdate(long timeout)

awaitMetadataUpdate…​FIXME

Note
awaitMetadataUpdate is used when…​FIXME

awaitPendingRequests Method

boolean awaitPendingRequests(Node node, Timer timer)

awaitPendingRequests…​FIXME

Note
awaitPendingRequests is used when…​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.

trySend Internal Method

long trySend(long now)

trySend…​FIXME

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

tryConnect Method

void tryConnect(Node node)

tryConnect simply requests the KafkaClient to initiate a connection to the given broker Node.

Note
tryConnect is used exclusively when FindCoordinatorResponseHandler is requested to onSuccess.

handlePendingDisconnects Internal Method

void handlePendingDisconnects()

handlePendingDisconnects…​FIXME

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

maybeTriggerWakeup Method

void maybeTriggerWakeup()

maybeTriggerWakeup…​FIXME

Note
maybeTriggerWakeup is used when…​FIXME

results matching ""

    No results matching ""