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 2021/08/12 09:12:20 UTC

[GitHub] [dubbo] kgdngitfk commented on issue #6025: 如何指定ip调用提供者

kgdngitfk commented on issue #6025:
URL: https://github.com/apache/dubbo/issues/6025#issuecomment-897476522


   我按照负载均衡自定义了LoadBalance,配置了
   <dubbo:reference  interface="xxx.xxx.autocharge.service.AutoChargeService" loadbalance="demo"/>
   注入bean
    @Reference
     AutoChargeService autoChargeService;
   再调用autoChargeService的方法时发现自定义扩展的loadbalance还是没有生效通过debug发现
   在org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker#initLoadBalance方法中
   这一段调用
   ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(invokers.get(0).getUrl()
                       .getMethodParameter(RpcUtils.getMethodName(invocation), LOADBALANCE_KEY, DEFAULT_LOADBALANCE));
   通过getMethodParameter获取到的loadbalance的值是空的所以使用了默认的RandomLoadBalance,于是我强制修改变量,将
   getExtension()的参数修改为自定义的loadbalance的名称,结果生效了
   ,所以我初步定位是在注册时没有把loadbalance的值放进去URL.parameters里面导致的,使用的dubbo版本是2.7.3的
   这个loadbalance是需要consumer和provider两边都要配置才行吗?
   
   


-- 
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