Creating a topic for Apache Kafka 0.9 Using Java

后端 未结 3 458
情话喂你
情话喂你 2021-01-13 13:59

I am programming a client to work with kafka 0.9. I want to know how to create a topic. This answer: How to create a Topic in Kafka through Java is similar to what I am aski

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-13 14:34

    I tried following Soon Chee Loong's answer with Kafka 0.9.0.1 but had to make one change. ZKStringSerializer is now private. To create ZkUtils I used the following API (it creates a ZkClient internally):

    ZkUtils.apply(
        "zookeeper1:port1,zookeeper2:port2",
        sessionTimeoutMs,
        connectionTimeoutMs,
        false)
    

提交回复
热议问题