Cucumber/GreenhouseManager/manager.py

17 lines
421 B
Python
Raw Normal View History

2024-10-28 14:47:20 +04:00
from kafka import KafkaProducer, KafkaConsumer
import kafka
import socket
2024-10-28 19:43:13 +04:00
from json import dumps, loads
import time
2024-10-28 14:47:20 +04:00
2024-10-29 16:07:02 +04:00
dataConsumer = KafkaConsumer(
'data',
2024-10-28 19:43:13 +04:00
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')))
2024-10-28 14:47:20 +04:00
2024-10-28 19:43:13 +04:00
while True:
2024-10-29 16:07:02 +04:00
for message in dataConsumer:
print(message)