BurningCN edited a comment on issue #9682: URL: https://github.com/apache/dubbo/issues/9682#issuecomment-1038903220
看了下,这的确是一个bug。 // ==================================================================================== - **背景**:单独在`应用级`服务发现模式下(非双注册),提供方以`tri`协议注册。 - **现象**:消费端任何引用方式(比如上面的`@DubboReference`方式)没有指定特定的协议,直接配置`dubbo.protocol.name=tri`。按理说会使用这里配置的`tri`作为默认消费方协议,并能成功发现提供者列表并发起调用。但是实际情况确使用了`dubbo`协议,配置`tri`协议未生效,从而导致找不到提供者列表,导致调用失败。(注:提供方配置以这种方式即`dubbo.protocol.name=tri`配置是生效的,因为`ServiceConfig#convertProtocolIdsToProtocols`方法中做了处理) - **调试**:`addListenerAndNotify->getAddresses` ,消费方提供的`com.example.demo.xxxxService:dubbo` 和 服务发现的 `com.example.demo.xxxxService:tri`无法匹配,从而导致上处错误`No provider available after` - **原因**:`dubbo.propertis`的配置`dubbo.protocol.name=tri`,没有将值传递到`ReferenceConfig#init`方法里面的`map`对象(`referenceParameters`)中,(前面`@DubboReference`方式能传递成功是因为`ReferenceConfig#appendConfig`方法中这行 `AbstractConfig.appendParameters(map, this)`,会将this即ReferenceConfig的Protocol写到这个map中)。而订阅流程走到`RegistryConfig#doCreateInvoker`方法中 执行`parameters.get(PROTOCOL_KEY) == null ? DUBBO : parameters.get(PROTOCOL_KEY)`会发现`parameters`没有`protocol`参数,导致使用默认的`dubbo`作为缺省值。 // ==================================================================================== 我会尝试修复下这个问题 -- 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]
