Using KafkaZkClient.apply

Just trying to write a simple java factory to retrieve list of topics, and the sample code I see does not use “ZKClientConfig zkClientConfig” where the apply function requires the zkClientConfig parameter and all examples do not have the config parameter?

my connection information for apply

String zookeeperHost = “127.0.0.1:9092”;

Boolean isSucre = false ;

int sessionTimeoutMs = 200000;

int connectionTimeoutMs = 15000;

int maxInFlightRequests = 10;

Time time = Time. SYSTEM ;

String metricGroup = “myGroup”;

String metricType = “myType”;

ZKClientConfig zkClientConfig = new ZKClientConfig();

zkClient = KafkaZkClient. apply (zookeeperHost,isSucre,sessionTimeoutMs,connectionTimeoutMs,maxInFlightRequests,time,metricGroup,zkClientConfig, metricType, metricType, isSucre);

This is the exception I receive:

Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
	at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:254)
	at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:108)
	at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1981)
	at kafka.zk.KafkaZkClient.apply(KafkaZkClient.scala)
	at kafkaFactory.makeConnextion(kafkaFactory.java:86)
	at kafkaFactory.<init>(kafkaFactory.java:70)
	at kafkaFactory$Test.main(kafkaFactory.java:121)

zk port should be 2181

String zookeeperHost = “127.0.0.1:2181”;

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.