Kafka Admin Client giving Timeout Error for ListTopic

Viewed 771

Hi I am trying to run this code in but it is working fine in another EC2 Azkaban instance but not giving below error for another instance.

private val adminprops = new Properties() 
adminprops.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,"Kafka Endpoint")
private val admin = AdminClient.create(adminprops)

def topicExist(topicName: String): Boolean = {
 val result = admin.listTopics.names.get.contains(topicName)
 result
}

"Kafka Exception java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics"

1 Answers

Network problem or setting problem.

  1. make sure "bootstrap.servers" is correct,right host and port.
  2. make sure the network is ok between the client and the broker server.

The default timeout of adminClient is 120000ms(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG). Normally,list topics return immediately.

Related