Environment
- Dubbo version: 2.7.3
- Operating System version: window
- Java version: 1.8
Steps to reproduce this issue
- 配置文件配置
nacos.address = 192.168.1.199:8848
nacos.dataId = dubbo-EsMobileClientLauncher-cousumer
nacos.namespace = fd4c2b5d-3649-4558-b85f-50b2f0eb6c4a
dubbo.registry.address = nacos://192.168.1.199:8848?namespace=fd4c2b5d-3649-4558-b85f-50b2f0eb6c4a
- 启动时启用动态配置中心,服务发现
@SpringBootApplication
@configuration
//@EnableCaching
//@EnableSwagger2
@EnableDubbo(scanBasePackages = "com")
@EnableNacosConfig(globalProperties = @NacosProperties(serverAddr = "${nacos.address}",namespace="${nacos.namespace}"))
@EnableNacosDiscovery(globalProperties = @NacosProperties(serverAddr = "${nacos.address}",namespace="${nacos.namespace}"))
@NacosPropertySource(dataId = "${nacos.dataId}",autoRefreshed=true)
public class EsMobileClientLauncherApplication
- dubbo-admin控制台配置条件路由
conditions:
=> host != 192.168.0.206
enabled: true
force: true
key: com.everstar.mobile.service.INetEventService:1.0.0
priority: 0
runtime: true
scope: service
发现条件路由并没有生效
- 通过debug查看控制台
debug了一下,发现

使用的NacosRegistry
也订阅了routers

日志显示注册完consumers以后,也进行了订阅了,Categories包含了routers
-
查看源码,发现
org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(URL url, NotifyListener listener)
会循环Categories

org.apache.dubbo.registry.nacos.NacosRegistry.doSubscribe(URL url, NotifyListener listener, Set serviceNames)
里没有循环Categories

-
更改nacos里的provider服务状态,可以监听到变更,控制台有打印变更的日志
更改nacos里的routers状态,监听不到变更,控制台没有变更的通知
-
怀疑NacosRegistry.doSubscribe里没有循环Categories,导致没有订阅routers
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
If there is an exception, please attach the exception trace:
Just put your stack trace here!
Environment
Steps to reproduce this issue
发现条件路由并没有生效
日志显示注册完consumers以后,也进行了订阅了,Categories包含了routers
查看源码,发现


org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(URL url, NotifyListener listener)
会循环Categories
org.apache.dubbo.registry.nacos.NacosRegistry.doSubscribe(URL url, NotifyListener listener, Set serviceNames)
里没有循环Categories
更改nacos里的provider服务状态,可以监听到变更,控制台有打印变更的日志
更改nacos里的routers状态,监听不到变更,控制台没有变更的通知
怀疑NacosRegistry.doSubscribe里没有循环Categories,导致没有订阅routers
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
If there is an exception, please attach the exception trace: