파이썬에서 동일한 그룹 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에 몇 개의 파티션이 있습니까? –