安装kafka
pip install kafka
kafka消费者
from kafka import KafkaConsumer consumer = KafkaConsumer('test_topic_v1',group_id='group-1',bootstrap_servers=['127.0.0.1:9092']) for message in consumer: print(message)