producer.poll(0)不会产生任何消息,但是producer.flush()可以工作]] << [

问题描述 投票:1回答:2
[当我使用producer.flush()时它可以工作,但是根据kafka confluent issue却性能不佳,但是如建议的那样,我使用producer.poll(0)但不会向主题发送任何消息,是否需要任何配置,或者我在这里缺少任何内容?

self.producer.produce(topic.value, data.encode('utf-8'), callback=self.delivery_report) self.producer.poll(0) # -> doesn't work self.producer.flush() # -> works

当我使用producer.flush()时,它可以工作,但根据卡夫卡融合问题,性能却很差,但是如建议的那样,我使用producer.poll(0),但不会对主题产生任何消息,是否有任何配置...
python apache-kafka confluent confluent-kafka
2个回答
0
投票
问题是poll()不能使生产者同步,只是调用事件并触发您注册的任何callback()

0
投票
消息没有发送到kafka,因为没有时间执行此操作。您的应用提前终止。
© www.soinside.com 2019 - 2024. All rights reserved.