queueing-consumer.py 386 Bytes
Newer Older
Nane Kratzke's avatar
Nane Kratzke committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os, time, random, json, socket
import redis
from messaging import MQueue

host = os.environ.get("REDIS_SVC", "redis-svc")
port = int(os.environ.get("REDIS_PORT", "6379"))
channel = os.environ.get("CHANNEL", "xqueue")

queue = MQueue(channel, redis.Redis(host=host, port=port, db=0))

for since, msg in queue.listen_as_group(group="consumers"):
    print(f"{ since }: { msg }")