Skip to content

nacos注册中心不监听routers变更 #5176

@manbab

Description

@manbab
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.3
  • Operating System version: window
  • Java version: 1.8

Steps to reproduce this issue

  1. 配置文件配置

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

  1. 启动时启用动态配置中心,服务发现

@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

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

发现条件路由并没有生效

  1. 通过debug查看控制台

debug了一下,发现
image
使用的NacosRegistry
也订阅了routers
image

日志显示注册完consumers以后,也进行了订阅了,Categories包含了routers

  1. 查看源码,发现
    org.apache.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(URL url, NotifyListener listener)
    会循环Categories
    image
    org.apache.dubbo.registry.nacos.NacosRegistry.doSubscribe(URL url, NotifyListener listener, Set serviceNames)
    里没有循环Categories
    image

  2. 更改nacos里的provider服务状态,可以监听到变更,控制台有打印变更的日志
    更改nacos里的routers状态,监听不到变更,控制台没有变更的通知

  3. 怀疑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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions