<p dir="auto">Hello, community</p>
<p dir="auto">We have previously roughly discussed the problems with Dubbo's metadata in GitHub issues and mailing list,  here when saying metadata I mainly refer to URL in Dubbo. Now I think it's time to bring the discussion onto the table and consider solving it.  Below is the proposal I've drafted:</p>
<p dir="auto"><strong>Problems</strong></p>
<p dir="auto">URL works as the carrier for Dubbo internal data transfer at runtime, and is also works as a protocol integrating with the external system: registration center, service query, service management, etc., resulting in serious coupling between the configuration and the registration center, and the data load pushed by the registration center is too large.</p>
<p dir="auto"><strong>Targets</strong></p>
<ul dir="auto">
<li>Keep URL unchanged at runtime, and even enrich the runtime URL; Keep the immutability of the URL during a single invoke from start to end.</li>
<li>Simplify Registry url as much as possible.</li>
<li>Refactor the way of doing service configuration, rely on Registry currently, switch to third-party Config Center while keeping compatible with old Overrides protocol.</li>
<li>Some data in URL are for service query purpose, we should register this part to another place instead of Registry. And it should be realized as extensible and users can decide to enable it or not.</li>
</ul>
<p dir="auto"><strong>Solutions</strong></p>
<p dir="auto">Here is a typical URL in Registry:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dubbo://10.122.111.22:20880/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?anyhost=true&amp;application=goods-compose&amp;default.actives=400&amp;default.delay=-1&amp;default.dispatcher=all&amp;default.group=online&amp;default.loadbalance=leastactive&amp;default.service.filter=-monitor&amp;default.threads=400&amp;default.timeout=2000&amp;default.version=1.0&amp;delay=1&amp;dubbo=2.6.2&amp;environment=product&amp;interface=com.xxx.compose.ic.service.vas.ValueAddServiceCompose&amp;logger=slf4j&amp;methods=queryValueAddServiceEditVOs,auditPassByValueAddServiceIdList,getValueAddServiceVOByServiceIds,getValueAddServiceInfoByGoodsIdList,getRuleMatchVOByGoodsIdList,getValueAddServiceEditVOById,getValueAddServiceEditVOByIds,queryValueAddServiceVOs,disableValueAddService,auditRejectByValueAddServiceIdList,saveValueAddServiceEditVO,enableValueAddService&amp;organization=someorg&amp;owner=somebody&amp;pid=54812&amp;revision=1.18.0628.3&amp;side=provider&amp;timestamp=1530671441040"><pre class="notranslate"><code class="notranslate">dubbo://10.122.111.22:20880/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?anyhost=true&amp;application=goods-compose&amp;default.actives=400&amp;default.delay=-1&amp;default.dispatcher=all&amp;default.group=online&amp;default.loadbalance=leastactive&amp;default.service.filter=-monitor&amp;default.threads=400&amp;default.timeout=2000&amp;default.version=1.0&amp;delay=1&amp;dubbo=2.6.2&amp;environment=product&amp;interface=com.xxx.compose.ic.service.vas.ValueAddServiceCompose&amp;logger=slf4j&amp;methods=queryValueAddServiceEditVOs,auditPassByValueAddServiceIdList,getValueAddServiceVOByServiceIds,getValueAddServiceInfoByGoodsIdList,getRuleMatchVOByGoodsIdList,getValueAddServiceEditVOById,getValueAddServiceEditVOByIds,queryValueAddServiceVOs,disableValueAddService,auditRejectByValueAddServiceIdList,saveValueAddServiceEditVO,enableValueAddService&amp;organization=someorg&amp;owner=somebody&amp;pid=54812&amp;revision=1.18.0628.3&amp;side=provider&amp;timestamp=1530671441040
</code></pre></div>
<p dir="auto">We can see this URL showed here is really long and redundant, here are my suggestions to refactor it step by step:</p>
<ol dir="auto">
<li>Only keep necessary part in Registry<br>
For example:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dubbo://10.122.111.22:20880/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?timeout=1000&amp;group=online&amp;version=1.0&amp;weight=100&amp;timestamp=1530671441040"><pre class="notranslate"><code class="notranslate">dubbo://10.122.111.22:20880/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?timeout=1000&amp;group=online&amp;version=1.0&amp;weight=100&amp;timestamp=1530671441040
</code></pre></div>
<ol start="2" dir="auto">
<li>Find a new place for those parameters only for query purpose<br>
For example:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="delay=1&amp;dubbo=2.6.2&amp;interface=com.xxx.compose.ic.service.vas.ValueAddServiceCompose&amp;logger=slf4j&amp;methods=queryValueAddServiceEditVOs,auditPassByValueAddServiceIdList,getValueAddServiceVOByServiceIds,getValueAddServiceInfoByGoodsIdList,getRuleMatchVOByGoodsIdList,getValueAddServiceEditVOById,getValueAddServiceEditVOByIds,queryValueAddServiceVOs,disableValueAddService,auditRejectByValueAddServiceIdList,saveValueAddServiceEditVO,enableValueAddService&amp;organization=someorg&amp;owner=somebody&amp;pid=54812&amp;revision=1.18.0628.3&amp;side=provider"><pre class="notranslate"><code class="notranslate">delay=1&amp;dubbo=2.6.2&amp;interface=com.xxx.compose.ic.service.vas.ValueAddServiceCompose&amp;logger=slf4j&amp;methods=queryValueAddServiceEditVOs,auditPassByValueAddServiceIdList,getValueAddServiceVOByServiceIds,getValueAddServiceInfoByGoodsIdList,getRuleMatchVOByGoodsIdList,getValueAddServiceEditVOById,getValueAddServiceEditVOByIds,queryValueAddServiceVOs,disableValueAddService,auditRejectByValueAddServiceIdList,saveValueAddServiceEditVO,enableValueAddService&amp;organization=someorg&amp;owner=somebody&amp;pid=54812&amp;revision=1.18.0628.3&amp;side=provider
</code></pre></div>
<ol start="3" dir="auto">
<li>Deprecate the Override protocol in Registry<br>
Typical Override protocol to change timeout value at runtime:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   override://0.0.0.0/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?category=configurators&amp;dynamic=false&amp;application=foo&amp;timeout=1000"><pre class="notranslate"><code class="notranslate">   override://0.0.0.0/com.xxx.compose.ic.service.vas.ValueAddServiceCompose?category=configurators&amp;dynamic=false&amp;application=foo&amp;timeout=1000
</code></pre></div>
<p dir="auto">We can instead integrate with thirdparty Config Center to do that, like Apollo, Archaius, Diamond and so on, these systems are more likely to be used in a miscroservice architecture.</p>
<p dir="auto">Furthermore, we can also consider separate the routing rule config from Registry and switch to Config Center,  using Config Center to dynamically add new group policies that can group service instances into different groups according to environments.</p>
<p dir="auto">Kindly ask for your suggestions, don't hesitate to let us know if you have any different ideas.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.7-SNAPSHOT</li>
<li>Operating System version: MacOS</li>
<li>Java version: OpenJDK 13</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>Open the dubbo-demo-xml project</li>
<li>Modify the registry center both of provider and consumer to Nacos；Open the check switch of consumer</li>
<li>Run the provider<br>
4.Run the consumer</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">The rpc can work properly.</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">It fails.</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Exception in thread &quot;main&quot; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url nacos://127.0.0.1:8848/org.apache.dubbo.registry.RegistryService?application=demo-consumer&amp;dubbo=2.0.2&amp;init=false&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello,sayHelloAsync&amp;pid=90344&amp;qos.port=33333&amp;register.ip=127.0.0.1&amp;side=consumer&amp;sticky=false&amp;timestamp=1584323664330 to the consumer 127.0.0.1 use dubbo version 
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:33)
Caused by: java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url nacos://127.0.0.1:8848/org.apache.dubbo.registry.RegistryService?application=demo-consumer&amp;dubbo=2.0.2&amp;init=false&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello,sayHelloAsync&amp;pid=90344&amp;qos.port=33333&amp;register.ip=127.0.0.1&amp;side=consumer&amp;sticky=false&amp;timestamp=1584323664330 to the consumer 127.0.0.1 use dubbo version 
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:350)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:258)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:158)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:68)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
	... 6 more"><pre class="notranslate"><code class="notranslate">Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url nacos://127.0.0.1:8848/org.apache.dubbo.registry.RegistryService?application=demo-consumer&amp;dubbo=2.0.2&amp;init=false&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello,sayHelloAsync&amp;pid=90344&amp;qos.port=33333&amp;register.ip=127.0.0.1&amp;side=consumer&amp;sticky=false&amp;timestamp=1584323664330 to the consumer 127.0.0.1 use dubbo version 
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:33)
Caused by: java.lang.IllegalStateException: Failed to check the status of the service org.apache.dubbo.demo.DemoService. No provider available for the service org.apache.dubbo.demo.DemoService from the url nacos://127.0.0.1:8848/org.apache.dubbo.registry.RegistryService?application=demo-consumer&amp;dubbo=2.0.2&amp;init=false&amp;interface=org.apache.dubbo.demo.DemoService&amp;methods=sayHello,sayHelloAsync&amp;pid=90344&amp;qos.port=33333&amp;register.ip=127.0.0.1&amp;side=consumer&amp;sticky=false&amp;timestamp=1584323664330 to the consumer 127.0.0.1 use dubbo version 
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:350)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:258)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:158)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:68)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
	... 6 more
</code></pre></div>