我需要設置卡夫卡生產者發送500 msgs在一個批次不是味精通過味精,但批量導入。我檢查https://github.com/dpkp/kafka-python/issues/479並試圖producer.send_messages(topic, *message)
但它失敗,錯誤:匯合卡夫卡Python庫配置生產者批量味精
> producer.send_messages('event_connector_mt', *load_entries)
E AttributeError: 'cimpl.Producer' object has no attribute 'send_messages'
我也試圖通過它像 producer.produce(topic, *message)
失敗:
producer.produce('event_connector_mt', *load_entries)
E TypeError: function takes at most 8 arguments (501 given)
所以我挖多了,發現了,我有設置生產者配置的類型是異步和batch.size比默認,但是當我嘗試像這樣配置:
from confluent_kafka import Consumer, Producer
producer = Producer(**{'bootstrap.servers': KAFKA_BROKERS,
'queue.buffering.max.messages': 1000000,
'batch.num.messages': 500,
'batch.size': 19999,
'producer.type': 'async'
})
失敗:
E KafkaException: KafkaError{code=_INVALID_ARG,val=-186,str="No such configuration property: "producer.type""}
同樣的錯誤了batch.size 你能品脫我在哪裏,以及我如何設置異步和批量大小或任何其他方式批量封郵件傳遞給卡夫卡0.9.3.1