You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
262 B
8 lines
262 B
5 months ago
|
from kafka import KafkaConsumer
|
||
|
|
||
|
# 创建消费者
|
||
|
consumer = KafkaConsumer('test-topic', bootstrap_servers='10.10.14.250:9092', auto_offset_reset='earliest')
|
||
|
|
||
|
# 消费消息
|
||
|
for message in consumer:
|
||
|
print(f"Received: {message.value.decode('utf-8')}")
|