sick-cat opened a new issue, #12824:
URL: https://github.com/apache/dubbo/issues/12824

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.2.5
   * Operating System version: mac 13.4
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1. dubbo项目使用apollo作为配置中心,并指定以下属性
       ```properties
       dubbo.config-center.group=mydubbo
       dubbo.config-center.namespace=mydubbo
       ```
   2. 在apollo的 mydubbo namespace下,添加一个配置项
       kye: myApp. configurators
       value: 
       ```yaml
       configVersion: v3.0
       scope: application
       key: myApp
       configs:
         - side: provider
           parameters:
             owner: apollo-pub-provider
       ```
   
   3.  启动项目,注意:apollo中并没有 dubbo namespace。   
   
   
   
   ### Expected Behavior
   
   <!-- What do you expect from the above steps?-->
   预期使用 `invoke org.apache.dubbo.metadata.MetadataService.getMetadataInfos()` 
获取元数据,会有 owner 属性。
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   实际debug下来,发现会从 dubbo namespace中获取数据。并没有使用 `dubbo.config-center.group` 配置的值。
   
   以下是 
`org.apache.dubbo.registry.integration.AbstractConfiguratorListener#initWith` 
的代码片段:
   
     ```java
     protected final void initWith(String key) {
           ruleRepository.addListener(key, this);
           String rawConfig = ruleRepository.getRule(key, 
DynamicConfiguration.DEFAULT_GROUP);
           if (!StringUtils.isEmpty(rawConfig)) {
               genConfiguratorsFromRawRule(rawConfig);
           }
   }
   ```
   
   
`org.apache.dubbo.configcenter.support.apollo.ApolloDynamicConfiguration#getConfig`
 中的实现,**理应使用url中的group属性值**。
   
   ```java
   @Override
   public String getConfig(String key, String group, long timeout) throws 
IllegalStateException {
       if (StringUtils.isNotEmpty(group)) {
           if (group.equals(url.getApplication())) {
               return ConfigService.getAppConfig().getProperty(key, null);
           } else {
               return ConfigService.getConfig(group).getProperty(key, null);
           }
       }
       return dubboConfig.getProperty(key, null);
   }
   ```
   
   addListener、removeListener也有类似问题,不过这两个方法不影响使用。
   


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