0
 def index() {

        def sessionTimeoutMs = 10000
        def connectionTimeoutMs = 10000
        def zkClient = new ZkClient("127.0.0.1:2181", sessionTimeoutMs, connectionTimeoutMs, ZKStringSerializer )

        def topicName = "myTopicoo"
        def numPartitions = 8
        def replicationFactor = 3
        def topicConfig = new Properties()
        AdminUtils.createTopic(zkClient, topicName, numPartitions, replicationFactor, topicConfig)

        Properties propy=new Properties()
        propy.put("metadata.broker.list","localhost:9092")
        propy.put("serializer.class", "kafka.serializer.StringEncoder")
        //propy.put("partitioner.class", "coughka.SimplePartitioner")
        propy.put("request.required.acks","1")

        ProducerConfig configuration=new ProducerConfig(propy)

        Producer<String,String> prod = new Producer<String,String>(configuration)
        def i=0
        while(i<90){
            prod.send(new KeyedMessage<String, String>("myTopicoo" , "nithin"+i.toString()))
            i++
        }
    }
}

error: Could not find matching constructor for: org.I0Itec.zkclient.ZkClient(java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Class)

I followed this: How Can we create a topic in Kafka from the IDE using API

Nicomedes E.
  • 1,326
  • 5
  • 18
  • 27
Nithin
  • 328
  • 1
  • 7
  • 16

0 Answers0