Example #1
0
class GrpcServiceManagementClient(ServiceManagementClient):
    def __init__(self, channel: grpc.Channel):
        self.service_stub = ManagementServiceStub(channel)

    def send_instance_props(self):
        self.service_stub.reportInstanceProperties(
            InstanceProperties(
                service=config.service_name,
                serviceInstance=config.service_instance,
                properties=[
                    KeyStringValuePair(key='language', value='Python')
                ],
            ))

    def send_heart_beat(self):
        logger.debug(
            'service heart beats, [%s], [%s]',
            config.service_name,
            config.service_instance,
        )
        self.service_stub.keepAlive(
            InstancePingPkg(
                service=config.service_name,
                serviceInstance=config.service_instance,
            ))
Example #2
0
 def __init__(self, channel: grpc.Channel):
     self.service_stub = ManagementServiceStub(channel)