zhanglizhouchanghe commented on issue #10713:
URL: https://github.com/apache/dubbo/issues/10713#issuecomment-1286433711

   dubbo-nacos版本不同,doRefer 代码
   ```java
       private <T> Invoker<T> doRefer(Cluster cluster, Registry registry, 
Class<T> type, URL url) {
           RegistryDirectory<T> directory = new RegistryDirectory<T>(type, url);
           directory.setRegistry(registry);
           directory.setProtocol(protocol);
           // all attributes of REFER_KEY
           Map<String, String> parameters = new HashMap<String, 
String>(directory.getUrl().getParameters());
           URL subscribeUrl = new URL(Constants.CONSUMER_PROTOCOL, 
parameters.remove(Constants.REGISTER_IP_KEY), 0, type.getName(), parameters);
           if (!Constants.ANY_VALUE.equals(url.getServiceInterface())
                   && url.getParameter(Constants.REGISTER_KEY, true)) {
               
registry.register(subscribeUrl.addParameters(Constants.CATEGORY_KEY, 
Constants.CONSUMERS_CATEGORY,
                       Constants.CHECK_KEY, String.valueOf(false)));
           }
           directory.subscribe(subscribeUrl.addParameter(Constants.CATEGORY_KEY,
                   Constants.PROVIDERS_CATEGORY
                           + "," + Constants.CONFIGURATORS_CATEGORY
                           + "," + Constants.ROUTERS_CATEGORY));
   
           Invoker invoker = cluster.join(directory);
           ProviderConsumerRegTable.registerConsumer(invoker, url, 
subscribeUrl, directory);
           return invoker;
       }
   ```
   
   测试了没有注册的 consumer 是已经执行了registry.register 了。“没有注册的 consumer” 
这个说法可能不对,是已经全部注册了,因为系统访问都是正常的,但是nacos控制台显示实例还是1 
。详情里面的元数据属性application=laundry-admin。看出consumers被替换了。
   提供者注册:
   
https://res.senlianshop.com/ad/%E6%8F%90%E4%BE%9B%E8%80%85%E6%B3%A8%E5%86%8C.png
   消费者1:
   https://res.senlianshop.com/ad/%E6%B6%88%E8%B4%B9%E8%80%851.png
   消费者注册1:
   
https://res.senlianshop.com/ad/%E6%B6%88%E8%B4%B9%E8%80%85%E6%B3%A8%E5%86%8C1.png
   消费者2:
   https://res.senlianshop.com/ad/%E6%B6%88%E8%B4%B9%E8%80%852.png
   消费者注册2:
   
https://res.senlianshop.com/ad/%E6%B6%88%E8%B4%B9%E8%80%85%E6%B3%A8%E5%86%8C2.png
   消费者注册2详情:
   
https://res.senlianshop.com/ad/%E6%B6%88%E8%B4%B9%E8%80%85%E6%B3%A8%E5%86%8C2%E8%AF%A6%E6%83%85.png
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to