zhangyz-hd opened a new issue #8370:
URL: https://github.com/apache/dubbo/issues/8370


   - [x] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   - [x] I have checked the 
[FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository 
and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.2-SNAPSHOT
   * Operating System version: ANY
   * Java version: 8
   
   ### Steps to reproduce this issue
   
   服务提供者端,传统服务发现模式,配置中心使用zookeeper或者apollo,注册2个服务
   ```
   <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
   
   <dubbo:config-center address="zookeeper://127.0.0.1:2182"/>
   ```
   
   消费者启动后,会在配置中心监节点级别的动态配置和服务级别的动态配置,以zookeeper为例,会监听:
   
   1. 节点级,path=/dubbo/config/dubbo/demo-provider.configurators
   2. 
服务级,path1=/dubbo/config/dubbo/org.apache.dubbo.demo.DemoService:1.2.3:G1.configurators
   3. 
服务级,path1=/dubbo/config/dubbo/org.apache.dubbo.demo.GreetingService:4.5.6:G2.configurators
   
   #### 场景1,节点级配置
   
   向`/dubbo/config/dubbo/demo-provider.configurators`写入DemoService的动态配置
   ```
   configVersion: v2.7
   scope: service
   key: G1/org.apache.dubbo.demo.DemoService:1.2.3
   configs:
   - addresses: ['0.0.0.0:20880']
     side: provider
     parameters:
       weight: 222
   ```
   根据提供者reExport日志,发现DemoService和GreetingService都按weight=222进行了重注册。
   
   #### 场景2,服务级配置
   
   
向`/dubbo/config/dubbo/org.apache.dubbo.demo.DemoService:1.2.3:G1.configurators`写入DemoService的动态配置
   ```
   configVersion: v2.7
   scope: service
   key: AAAAA  <--瞎写就行
   configs:
   - addresses: ['0.0.0.0:20880']
     side: provider
     parameters:
       weight: 333
   ```
   根据提供者reExport日志,发现DemoService按weight=333进行了重注册。
   
   #### 总结
   
   1. 
可以发现yaml中的key没有实际存在的意义,因为key中的服务信息,在DynamicConfiguration实现,以及ConfigChangeListener中都有,在AbstractConfiguratorListener#genConfiguratorsFromRawRule传入即可。此处key属性可取消。
   2. 作为scope: 
service的配置,写入节点级配置路径也能生效,此处最好能控制监听逻辑。节点级只响应scope:application的yaml,服务级只响应scope:service的yaml,或者也可取消scope属性。


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