Reputation: 2764
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?
Upvotes: 1
Views: 1564
Reputation: 6418
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.
Upvotes: 4