Closed saiyujs closed 1 year ago
Currently, there is no easy way to do that. One way is creating the Channel via the GrpcChannelFactory and create the Stub yourself in the calling code (potentially cached). We plan to make the stubs directly accessible/requestable as described here: https://github.com/yidongnan/grpc-spring-boot-starter/issues/741#issuecomment-1247148603
Closing as duplicate.
分享一下解决方法。 通过https://github.com/yidongnan/grpc-spring-boot-starter/issues/741#issuecomment-1247148603 里面的架构图,得到启发,thx!!!
我有多个服务端,其中有10个服务端在机房A,服务名叫xxxx-A;有另外10个服务端在机房B,服务名叫xxx-B。 需求有的请求必须要请求服务xxx-A,有的请求必须要请求服务xxx-B。 以后可能还会有机房C,所以如何可以动态创建channel? 其功能就是类似rest+@LoadBalanced,可以通过我传入的服务名,动态选择channel。 感谢回复!!