1

Does anybody know if

kafka.javaapi.producer.Producer

can be reused among several method invocations (e.g. several send(...)) or it should be closed each time?

Andrea
  • 2,714
  • 3
  • 27
  • 38

1 Answers1

4

Yes, it can surely be reused. Producer creation is pretty slow operation because it requires establishing connection to all partitions (and probably zookeeper). So, Producers should be reused when possible.

Wildfire
  • 6,358
  • 2
  • 34
  • 50