返回主题:RPC框架调用链与机制

知识卡片

结构图卡 · 7878.a

代理对象隐藏RPC传输细节

理解等级:中级

RpcCallerDemoService持有RpcProxy(“rpc_responder_demo_service”),remote_hello(value)经代理调用响应服务hello(name)。两端name供框架绑定服务,@rpc标记可远程调用方法。图中是依赖与代理,不是两个服务类的继承;调用看似普通方法,也不能忘记远程失败与等待。

可联系[[消息代理也可承载请求响应]]理解条件与边界。

结构图:

类图:虚线三角表示实现接口,箭头表示依赖,实线菱形表示组合。

classDiagram
    class RpcCallerDemoService {
        +name = rpc_caller_demo_service
        +remote: RpcProxy
        +remote_hello(value="John Doe")
    }
    class RpcProxy
    class RpcResponderDemoService {
        +name = rpc_responder_demo_service
        +hello(name)
    }
    RpcCallerDemoService --> RpcProxy : remote依赖
    RpcProxy ..> RpcResponderDemoService : 通过服务名远程调用hello
这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《微服务实战》第7章《构建可复用的微服务框架》(来源项目book-sources;extracted/微服务实战/_epub-src/text/part0017_split_003.html;src-180)。 - 结论依据:清单7.1保留真实类名、方法和参数,未补造返回类型或远程继承。 - 原始内容:remote = RpcProxy("rpc_responder_demo_service")