Closed hankeyyh closed 6 months ago
类似grpc,kitex会在pb中显示构建serviceInfo,其中指定了handler。内部路由时可以摆脱反射。
var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _Greeter_SayHello_Handler, }, },
这个rpcx很早就实现了,性能上要比反射好一些
https://github.com/rpcxio/rpcx-examples/blob/master/handler/server/server.go#L14
类似grpc,kitex会在pb中显示构建serviceInfo,其中指定了handler。内部路由时可以摆脱反射。