17 lines
421 B
Python
17 lines
421 B
Python
from kafka import KafkaProducer, KafkaConsumer
|
|
import kafka
|
|
import socket
|
|
from json import dumps, loads
|
|
import time
|
|
|
|
dataConsumer = KafkaConsumer(
|
|
'data',
|
|
bootstrap_servers=['localhost:9092'],
|
|
auto_offset_reset='earliest',
|
|
enable_auto_commit=True,
|
|
group_id='my-group',
|
|
value_deserializer=lambda x: loads(x.decode('utf-8')))
|
|
|
|
while True:
|
|
for message in dataConsumer:
|
|
print(message) |