Pythonで同じグループIDを持つ複数のコンシューマを実行する方法を知っている人はいますか? 私は次のように試しましたPythonで同じグループidを持つ複数のコンシューマ
a = Consumer({'bootstrap.servers': 'localhost:9092', 'group.id': 'dd1',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
b = Consumer({'bootstrap.servers': 'localhost:9092', 'group.id': 'dd1',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
c = Consumer({'bootstrap.servers': 'localhost:9092', 'group.id': 'dd1',
'default.topic.config': {'auto.offset.reset': 'smallest'}})
a.subscribe([topic_to_read])
b.subscribe([topic_to_read])
c.subscribe([topic_to_read])
running = True
while running:
msg1 = a.poll(timeout=timeout)
msg2 = b.poll(timeout=timeout)
msg3 = c.poll(timeout=timeout)
これは動作しません。 私はマルチプロセッシングのlibを使ってみましたが、動作させることができません。
なぜそれが動作していないと言いますか?あなたは同じグループにそれらを入れて行動することを期待していますか? topic_to_readにはいくつのパーティションがありますか? –