zrlw commented on issue #13298: URL: https://github.com/apache/dubbo/issues/13298#issuecomment-1812024229
debug跟踪了代码,consumer订阅服务调用```ServiceDiscoveryRegistry#doSubscribe```时,先调用```ServiceNameMapping#getMappingByUrl```读取AbstractReferenceConfig的providedBy属性,如果这个属性有值,就直接将其作为接口名和应用名的映射关系,看了一下代码注释,发现它的用途就是指定接口所属的应用级别服务名: ``` /** * declares which app or service this interface belongs to */ protected String providedBy; ``` consumer只需要配置这个属性,比如: ``` @DubboRerference(providedBy = "helloTestApp") private HelloAservice helloService; ``` 就不再需元数据中心保存各个接口名与应用名的映射关系了。 这样nacos-sync也能在注册中心集群之间同步metadata-type=local方式的应用服务实例了。 -- 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-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org