Commit 87914ee3 authored by Nane Kratzke's avatar Nane Kratzke
Browse files

Add hostname to producer message

parent 819b8f41
import os, time, random, json
import os, time, random, json, socket
import redis
host = os.environ.get("REDIS_SVC", "redis-svc")
......@@ -7,9 +7,10 @@ channel = os.environ.get("CHANNEL", "xfan")
stream = redis.Redis(host=host, port=port, db=0)
me = socket.gethostname()
i = 1
while True:
msg = f"Message { i }"
msg = f"Hi, this is the message #{ i } from { me }."
i = i + 1
n = random.randint(1, 3)
time.sleep(n)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment