shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

modify dubbo plugin configuration based on selector

Open Wweiei opened this issue 9 months ago • 4 comments

complete task 4 in #5923 , modify dubbo registry config base on selector.

  1. i add one parameter "registry" in dubbo selector, and change "protocol" to not required. image
  2. for example, change the shenyu-examples-apache-dubbo-service's dubbo.registry.address to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos' image 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 image when invoke the api 'http://localhost:9195/dubbo/findById', it will throw No provider exception. image
  3. set the dubbo selector parameter to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos' image when invoke the api the 'dubboUpstreams' is not empty in ApacheDubboProxyService.java#getReferenceConfig image then chose one upstream and create a new ReferenceConfig<GenericService> with a new cacheKey image finally, it will use the new ReferenceConfig<GenericService> to invoke the dubbo interface through the new registry。 image
  4. 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。 image 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 avatar Mar 07 '25 08:03 Wweiei

@Wweiei if u got time, fix the conflicts

Aias00 avatar Mar 20 '25 03:03 Aias00

@Wweiei if u got time, fix the conflicts ok, i have fixed it

Wweiei avatar Mar 20 '25 03:03 Wweiei

@Wweiei hi, fix the ci, pls

Aias00 avatar Mar 27 '25 01:03 Aias00

@Wweiei fix ci pls

Aias00 avatar Apr 10 '25 12:04 Aias00