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 2022/08/17 03:17:19 UTC

[GitHub] [dubbo] wlf950328 opened a new issue, #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

wlf950328 opened a new issue, #10475:
URL: https://github.com/apache/dubbo/issues/10475

   <!-- 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: 2.7.8 & 3.0.11
   * Operating System version: Win10
   * Java version: JDK 1.8
   
   ### Steps to reproduce this issue
   
   1. Create multiple providers(创建多个服务生产者)
   2. Multi-service interface configuration in consumer configuration file(在消费者服务配置文件中配置多服务接口信息)
   3. Run and Test (运行并调用测试)
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   Below is the code sample for both versions. (Only the version is different)
   以下是两个版本的代码示例(仅版本不同)
   https://github.com/wlf950328/dubbo-demo-2.7.8 (dubbo-2.7.8)
   https://github.com/wlf950328/dubbo-demo-3.0.11 (dubbo-3.0.11)
   
   ### Expected Behavior
   
   <!-- What do you expect from the above steps?-->
   
   I hope the configured multiple services can take effect. 
   我希望消费者配置的多服务都能正确生效
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   In fact, although there is no abnormality, only one multi-service configured by the consumer takes effect, and the rest of the service configurations will have the following behaviors:
   · If the method name is the same as the effective service method name, use the configuration of the effective interface
   · Otherwise, use the default configuration (for example, the interface timeout is the default 1s)
   
   实际虽然没有任何异常, 但是消费者配置的多服务仅生效了一个, 而其余的服务配置会有如下行为:
   · 如果方法名与生效的服务方法名相同, 那么使用生效的配置
   · 否则使用默认配置(比如接口超时时间为默认的1s)
   
   
   ### Something Else
   In the demo, the configuration file uses the yaml format. I also use the properties format configuration, the problem also exists.
   在示例中, 配置文件是yaml格式的.  我另外还使用了 properties 格式的配置, 问题同样存在
   
   Paste the configuration of the consumer service below.
   下面贴上消费者服务的配置
   
   yaml:
   ```
   dubbo:
     application:
       name: dubbo-demo-consumer
     registry:
       address: zookeeper://127.0.0.1:2181
     consumers:
       userInfoService1: # 有效 efficient
         parameters:
           getUserInfoById:
             timeout: 4000
             async: false
             sent: false
             retries: 1
       userInfoService2: # 无效 invalid
         parameters:
           getUserInfo:
             timeout: 1200
             async: false
             sent: false
             retries: 1
           getUserInfoById:
             timeout: 2000
             async: false
             sent: false
             retries: 3
   ```
   
   properties:
   ```
   dubbo.application.name=dubbo-demo-consumer
   dubbo.registry.address=zookeeper://127.0.0.1:2181
   dubbo.consumers.userInfoService1.parameters[getUserInfoById.timeout]=4000
   dubbo.consumers.userInfoService2.parameters[getUserInfoById.retries]=1
   dubbo.consumers.userInfoService2.parameters[getUserInfoById.timeout]=2000
   dubbo.consumers.userInfoService2.parameters[getUserInfo.retries]=3
   dubbo.consumers.userInfoService2.parameters[getUserInfo.timeout]=1200
   dubbo.consumers.userInfoService2.parameters[getUserInfo.retries]=1
   ```


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


[GitHub] [dubbo] wlf950328 commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
wlf950328 commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1220189340

   > Dubbo 的 consumer 是作为默认值存在的,所以没有支持配置多 consumer config 的能力。对单一一个服务的配置要使用 reference config 进行配置。
   
   意思是, 在一个消费者中多生产者接口配置还是要在@DubboReference注解上进行配置是吗?
   或者说配置文件是否也有类似的配置, 有的话能否贴上一个正确的多生产者的接口配置


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


[GitHub] [dubbo] AlbumenJ commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1220167192

   Dubbo 的 consumer 是作为默认值存在的,所以没有支持配置多 consumer config 的能力。对单一一个服务的配置要使用 reference config 进行配置。


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


[GitHub] [dubbo] AlbumenJ commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1220190100

   https://dubbo.apache.org/zh/docs3-v2/java-sdk/reference-manual/config/annotation/#%E9%80%9A%E8%BF%87-dubboproperties-%E8%A1%A5%E5%85%85%E9%85%8D%E7%BD%AE


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


[GitHub] [dubbo] AlbumenJ commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1220190206

   https://dubbo.apache.org/zh/docs3-v2/java-sdk/reference-manual/config/properties/
   https://dubbo.apache.org/zh/docs3-v2/java-sdk/reference-manual/config/principle/


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


[GitHub] [dubbo] chickenlj commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
chickenlj commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1234045158

   > 意思是, 在一个消费者中多生产者接口配置还是要在@DubboReference注解上进行配置是吗?
   
   所有的配置形式并不是对等的,也很难提供对等能力,就 yaml 或注解格式是有你说的这个限制。
   
   你可以选择对每个 Reference 单独指定配置;或者选用其他配置形式,如 JavaConfig 形式,生成多个 ConsumerConfig 实例,并为每个 Reference 关联自己的 ConsumerConfig。可以参考上面的文档链接查看各种不同的配置形式


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


[GitHub] [dubbo] chickenlj closed issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
chickenlj closed issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)
URL: https://github.com/apache/dubbo/issues/10475


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


[GitHub] [dubbo] wlf950328 commented on issue #10475: Combined with Spring boot, file configuration, multi-service interface configuration only takes effect for one service(Springboot文件形式配置, 多服务接口配置仅一个服务生效)

Posted by GitBox <gi...@apache.org>.
wlf950328 commented on issue #10475:
URL: https://github.com/apache/dubbo/issues/10475#issuecomment-1217416771

   2.7.8版本能定位到  ReferenceConfig.init() -> ReferenceConfig.checkAndUpdateSubConfigs() -> ReferenceConfigBase.checkDefault() -> ConfigManager.getDefaultConsumer() 这里只会获取一个作为默认的ConsumerConfig
   
   ```
       public Optional<ConsumerConfig> getDefaultConsumer() {
           List<ConsumerConfig> consumerConfigs = getDefaultConfigs(getConfigsMap(getTagName(ConsumerConfig.class)));
           if (CollectionUtils.isNotEmpty(consumerConfigs)) {
               return Optional.of(consumerConfigs.get(0));
           }
           return Optional.empty();
       }
   ```
   
   
   3.0.11 能定位到 AbstractConfigManager.addConfig() 中的代码
   ```
   // 问题一
           Map<String, AbstractConfig> configsMap = (Map)this.configsCache.computeIfAbsent(AbstractConfig.getTagName(config.getClass()), (type) -> {
               return new ConcurrentHashMap();
           });
           if (!(config instanceof ReferenceConfigBase) && !(config instanceof ServiceConfigBase)) {
               Iterator var3 = configsMap.values().iterator();
   
               while(var3.hasNext()) {
                   AbstractConfig value = (AbstractConfig)var3.next();
                   if (value.equals(config)) { // 问题二
                       return value;
                   }
               }
           }
   ```
   1、两个服务放入map的key都是一样的
   2、equals并没有获取到所有属性值, 还跳过了本不一样的id属性
   
   以上是本人的调试猜测, 不一定准确


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