# -*- coding: utf-8 -*-
import sys
import json
import time
from kafka import KafkaConsumer #pip3 install kafka-pythoni
# for message in KafkaConsumer('sushe-topic',bootstrap_servers=['10.32.236.11:9092']):
# for message in KafkaConsumer('OSPF_Neighbours',bootstrap_servers=['10.84.16.201:9092']):
# for message in KafkaConsumer('szsy-10.203.100.15-26-topic',bootstrap_servers=['10.200.34.18:9092']):
for message in KafkaConsumer('zb-inil-fw-10-84-16-3-topic',bootstrap_servers=['10.84.16.243:9092']):
# jsonData = message.value.decode('utf-8')
# info = json.loads(jsonData)
# message = json.loads(jsonData).get('message')
# print(message)
# if 'call_10.82.0.0-16' in message:
# print(message)
print( #message.partition,info)
f"Partition: {message.partition}, Offset: {message.offset}, Key: {message.key}, Value: {message.value.decode('utf-8')}")
# time.sleep(120)
08-08
1604
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-01
771
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-10