bigchungusdata/zmq/publisher.py

16 lines
283 B
Python
Raw Normal View History

2021-04-25 12:16:11 +02:00
#!/usr/bin/env python3
import zmq
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://127.0.0.1:5559")
2021-04-25 12:23:17 +02:00
n = 10
2021-04-25 12:33:49 +02:00
msg_body = "\"" + "a" * n + "\""
2021-04-25 12:16:11 +02:00
try:
while True:
socket.send_string(f"test {msg_body}")
2021-04-25 12:24:41 +02:00
except KeyboardInterrupt:
2021-04-25 12:34:17 +02:00
socket.close()