0

Trying to create a consumer in kafka using zookeeper but was not able to.But using bootstrap server consumer start listening. Can anyone help if is it good idea to connect to broker directly without zookeeper. If we want to connect using zookeeper, how that can be achieved.

val properties = new Properties()
    properties.put("bootstrap.servers", "localhost:9092")
    properties.put("group.id","grp1")
    properties.put("key.deserialize", classOf[StringDeserializer])
    properties.put("value.deserializer", classOf[StringDeserializer])

how can we connect to zookeeper.

shubham
  • 23
  • 1
  • 6
  • 2
    clients don't talk to zookeper directly anymore. Bootstrap server (broker) is now the endpoint for both consumers and producers. – aran May 27 '19 at 12:03
  • 1
    Scala kafka consumer have been removed in Kafka 2.0.0. See https://stackoverflow.com/q/56180566/380250 – Gery May 27 '19 at 13:55
  • thanks @aran, if clients don't talk to zookeeper directly than what will be role of zookeeper. kafka is distributed and it requires state management and zookeeper was trusted with this responsibility, if it is removed how this management is being achieved. It will be great if anyone help me understand. – shubham May 28 '19 at 04:59
  • Take a look here @shubham . Point 6 disappears, so the broker is the one with thar role now. https://www.quora.com/What-is-the-actual-role-of-Zookeeper-in-Kafka-What-benefits-will-I-miss-out-on-if-I-don%E2%80%99t-use-Zookeeper-and-Kafka-together/answer/Gwen-Shapira – aran May 28 '19 at 06:08

0 Answers0