Reputation: 5154
I'm having problem using the last answer of this question in my Java code. Kafka: Get broker host from ZooKeeper
Specifically, it fails finding the last argument on this line:
ZkClient client = new ZkClient("localhost:2181", 10000, kafka.utils.ZKStringSerializer);
I'm using Maven and these are the dependencies in the pom.xml if it matters.
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>0.8.2.2</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.7</version>
</dependency>
</dependencies>
Upvotes: 0
Views: 563
Reputation: 725
You have to use like this
ZkClient client = new ZkClient("localhost:2181", Integer.MAX_VALUE,10000, kafka.utils.ZKStringSerializer$.MODULE$);
kafka.utils.ZKStringSerializer is a scala object. To use scala object in java you have to use like above.
Upvotes: 2