shenyu
shenyu copied to clipboard
modify dubbo plugin configuration based on selector
complete task 4 in #5923 , modify dubbo registry config base on selector.
- i add one parameter "registry" in dubbo selector, and change "protocol" to not required.
- for example, change the shenyu-examples-apache-dubbo-service's dubbo.registry.address to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos'
if the dubbo selector parameter registry is empty, it will use the default plugin config. i add a common method to get the dubbo ReferenceConfig<GenericService> in ApacheDubboProxyService.java#getReferenceConfig
when invoke the api 'http://localhost:9195/dubbo/findById', it will throw No provider exception.
- set the dubbo selector parameter to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos'
when invoke the api the 'dubboUpstreams' is not empty in ApacheDubboProxyService.java#getReferenceConfig
then chose one upstream and create a new ReferenceConfig<GenericService> with a new cacheKey
finally, it will use the new ReferenceConfig<GenericService> to invoke the dubbo interface through the new registry。
- when build the ReferenceConfig<GenericService> in ApacheDubboConfigCache.java, it will use the new dubbo RegistryConfig and the dubbo rule config is not used in default model. so i wrote a new buildReference method。
And when use the multi registry or there are multiple Dubbo instances, the custom dubbo LoadBalance ApacheDubboGrayLoadBalance will be triggered, so when build the ReferenceConfig<GenericService> i didn't use reference.setLoadbalance("gray") and methodConfig.setLoadbalance("gray").
Make sure that:
- [x] You have read the contribution guidelines.
- [x] You submit test cases (unit or integration tests) that back your changes.
- [x] Your local test passed
./mvnw clean install -Dmaven.javadoc.skip=true.
@Wweiei if u got time, fix the conflicts
@Wweiei if u got time, fix the conflicts ok, i have fixed it
@Wweiei hi, fix the ci, pls
@Wweiei fix ci pls