def receiver(queue, client_api_stub, topic): subscribe = client_api_pb2.SubscribeRequest(correlation_id=str( uuid.uuid4()), topic=topic) messages = client_api_stub.Subscribe(subscribe) for message in messages: logger.debug("Subscription : %s" % message) queue.put(message)
def receiver(pub_sub_stub, topic): while True: try: subscribe = client_api_pb2.SubscribeRequest(correlation_id=str( uuid.uuid4()), topic=topic) res = pub_sub_stub.Subscribe(subscribe) logger.info("Subscribed : %s " % (res.correlation_id)) return except: logger.error("Can't connect to sidecar")
def receiver(queue, pub_sub_stub, topic): while True: try: subscribe = client_api_pb2.SubscribeRequest(correlation_id=str( uuid.uuid4()), topic=topic) messages = pub_sub_stub.Subscribe(subscribe) for message in messages: logger.debug("Subscription : %s" % message) queue.put(message) except: logger.error("Can't connect to sidecar") time.sleep(5)