15 lines
315 B
Python
15 lines
315 B
Python
import sys
|
|
from kafka import KafkaProducer
|
|
from config import CONFIG
|
|
|
|
producer = KafkaProducer(compression_type='zstd', **CONFIG)
|
|
topic = 'chat'
|
|
|
|
key = input('Key: ').encode()
|
|
|
|
for line in sys.stdin:
|
|
line = line.rstrip()
|
|
if '.' == line:
|
|
break
|
|
|
|
producer.send(topic, key=key, value=line.encode())
|