Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有人知道
kafka.javaapi.producer.Producer
可以在多个方法调用(例如多个 send(...))之间重用,还是每次都应该关闭?
是的,它肯定可以重复使用。Producer创建是非常缓慢的操作,因为它需要建立与所有分区(可能还有 zookeeper)的连接。因此,应尽可能重用生产者。
Producer