liubao68 commented on issue #1661: 怎么获取同一APPID Provider的所有实例信息
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1661#issuecomment-603738466
 
 
   这里提供了一个例子,如何实现你的场景:
   
   https://github.com/apache/servicecomb-java-chassis/pull/1664 
   
   1. 通过 DiscoveryTree 获取某个微服务的所有实例;
   2. 调用 Provider 接口的时候, 指定具体的实例信息。 
   
   不过这个 PR 没合入,有两个问题需要注意:
   1. 如果采用 RestTemplate 调用, 设置 local context 有问题
   2. 如果采用 RPC 调用, 需要注意这个接口只能够声明一个 consumer, 携带 InvocationContext 参数
   
   如果你是在某个 REST 接口里面调用其他服务的接口, 则可以直接使用:
   
   ```
   ContextUtils.getInvocationContext().addLocalContext 设置地址信息,则不会存在上述两个问题。 
   
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to