2023-07-18 10:32:44 +08:00
|
|
|
from nameko.rpc import rpc, ServiceRpc
|
2023-05-22 15:54:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
class RpcResponderDemoService:
|
|
|
|
name = "rpc_responder_demo_service"
|
|
|
|
|
|
|
|
@rpc
|
|
|
|
def hello(self, name):
|
|
|
|
return "Hello, {}!".format(name)
|
|
|
|
|
|
|
|
|
|
|
|
class RpcCallerDemoService:
|
|
|
|
name = "rpc_caller_demo_service"
|
|
|
|
|
2023-07-18 10:32:44 +08:00
|
|
|
remote = ServiceRpc("rpc_responder_demo_service")
|
2023-05-22 15:54:01 +08:00
|
|
|
|
|
|
|
@rpc
|
|
|
|
def remote_hello(self, value="John Doe"):
|
|
|
|
res = u"{}".format(value)
|
|
|
|
return self.remote.hello(res)
|