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("consumers"): # We would normally process the messages here. # However, to not overflow the log we skip this here. # You can print the message, if you want. # print(f"{ since }: { msg }") print()