You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/11/17 03:11:26 UTC

[GitHub] [dubbo-js] hufeng commented on issue #302: dubbo3 - stub模块

hufeng commented on issue #302:
URL: https://github.com/apache/dubbo-js/issues/302#issuecomment-1318000360

   grpc 生成的client stub service的 代码逻辑:
   
   ```js
   // The greeting service definition.
   var GreeterService = exports.GreeterService = {
     // Sends a greeting
   sayHello: {
       path: '/helloworld.Greeter/SayHello',
       requestStream: false,
       responseStream: false,
       requestType: helloworld_pb.HelloRequest,
       responseType: helloworld_pb.HelloReply,
       requestSerialize: serialize_helloworld_HelloRequest,
       requestDeserialize: deserialize_helloworld_HelloRequest,
       responseSerialize: serialize_helloworld_HelloReply,
       responseDeserialize: deserialize_helloworld_HelloReply,
     },
   };
   exports.GreeterClient = grpc.makeGenericClientConstructor(GreeterService);
   ```
   
   针对dubbo-js设计:
   我建议这块的设计仍然可以参考dubbo-js/dubbo2分支的proxyservice的设计,对于client方invoke调用来说核心的是两点,
   
   - 方便获取服务调用的metadata和payload
     - path, request/response stream flag, req/res type schema
   - 开发的体验,通过typescript类型的动态推导,实现真正的本地方法调用的体验
      - 代码的提示,静态的检查等
   
   还有序列话模块的部分,我们是不是应该设计出一个独立的encode和decode的能力,不跟着具体的生成的rpc的stub代码走
   - 交给invoke在请求之前进行调用
   - 这样的好处,生成的stub service比较干净简单 代码量也非常的少
   - stub service 简单意味着将来我们特性改进如果升级比较简单一些 
   - 序列化模块根据参数重的req/res的type schema进行序列化和反序列化
   
   其他同学 补充讨论 ~~~
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org