Skip to content

KafkaAdminClient

KafkaAdminClient is a AdminClient that is used in Kafka administration utilities.

Creating Instance

KafkaAdminClient takes the following to be created:

  • AdminClientConfig
  • Client ID
  • Time
  • AdminMetadataManager
  • Metrics
  • KafkaClient
  • TimeoutProcessorFactory
  • LogContext

KafkaAdminClient is created using createInternal.

createInternal

KafkaAdminClient createInternal(
  AdminClientConfig config,
  AdminMetadataManager metadataManager,
  KafkaClient client,
  Time time)
KafkaAdminClient createInternal(
  AdminClientConfig config,
  TimeoutProcessorFactory timeoutProcessorFactory) // (1)!
KafkaAdminClient createInternal(
  AdminClientConfig config,
  TimeoutProcessorFactory timeoutProcessorFactory,
  HostResolver hostResolver)
  1. Uses an undefined HostResolver

createInternal...FIXME


createInternal is used when:

  • Admin is requested to create

Logging

Enable ALL logging level for org.apache.kafka.clients.admin.KafkaAdminClient logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.org.apache.kafka.clients.admin.KafkaAdminClient=ALL

Refer to Logging.

Review Me

Triggerring Preferred Replica Leader Election

ElectPreferredLeadersResult electPreferredLeaders(
  Collection<TopicPartition> partitions,
  ElectPreferredLeadersOptions options)

NOTE: electPreferredLeaders is part of the <> to trigger <>.

electPreferredLeaders creates a electPreferredLeaders call that simply uses <> to <> and, when a response comes in, requests the ElectPreferredLeadersRequest to <>.

In the end, electPreferredLeaders requests the <> to <> the electPreferredLeaders call.