Hi,

We are using kafka-clients library for integrating Kafka with a Scala
application.

Following points explain our understanding so far about creation of the TCP
connections between Brokers and Producers-Consumers:

   1. No TCP connection is established on initialisation of KafkaProducer
   instance.

   val producer = new KafkaProducer[String, String](properties)

   This also holds true for KafkaConsumer.

   val consumer = new KafkaConsumer[String, String](properties)

   2. First TCP connection (between Broker and Producer) is established on
   producing a record to Broker.

   producer.send(record1)

   3. Subsequent send() calls from the same Producer to same Broker will
   share same TCP connection irrespective of the Topic.

   producer.send(record2)

   4. In case of Consumer, first TCP connection is established on polling a
   Topic (not on Subscription).

   val records = consumer.poll(timeout)

   5. Subsequent calls to poll by the same Consumer to the same Broker
   share the same connection.


Please verify our understanding around TCP connections managed by
kafka-clients library. Also it would be helpful if you can refer some
resources which will give us a better understanding around it.

Thanks,
Dolly

Reply via email to