def run():
creds = grpc.ssl_channel_credentials(root_certificates=open('/certs/cert.pem', 'rb').read())
channel = grpc.secure_channel('lb:50051', creds)
stub = helloworld_pb2_grpc.GreeterStub(channel)
while True:
try:
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
logger.error("Greeter client received: " + response.message)
time.sleep(3)
except Exception as e:
logger.error('Could not connect load-balancer. error {}'.format(e))
time.sleep(3)
评论列表
文章目录