我在同一组(我的组)中有一个生产者和一个消费者。
# To send messages asynchronously
producer = SimpleProducer(kafka, async=True)
producer.send_messages("my-topic", "async message")
# To consume messages, consumer1
consumer1 = SimpleConsumer(kafka, "my-group", "my-topic")
for message in consumer1:
print(message)
1条答案
按热度按时间c3frrgcw1#
simpleconsumer不支持消费群体,您应该使用kafkaconsumer。