-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/nacos config #3988
Feature/nacos config #3988
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3988 +/- ##
============================================
- Coverage 63.81% 63.41% -0.41%
- Complexity 71 565 +494
============================================
Files 744 750 +6
Lines 32209 32415 +206
Branches 5127 5145 +18
============================================
+ Hits 20555 20556 +1
- Misses 9305 9500 +195
- Partials 2349 2359 +10
Continue to review full report at Codecov.
|
This pull request is targeting #3846 . I will start to review today. Thanks for the pull request, I was planning to do it. Do you have interest in implementing Nacos as a metadata center? There are many examples in dubbo-metadata-report module. If not, I am planning to do it. |
...cos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
Show resolved
Hide resolved
I got the following errors when running the
But the second run is OK. Adding some sleep to between put("dubbo-config-org.apache.dubbo.nacos.testService.configurators", "hello");
Thread.sleep(200);
put("dubbo-config-dubbo.properties:test", "aaa=bbb");
Thread.sleep(200);
Assert.assertEquals("hello", config.getConfig("org.apache.dubbo.nacos.testService.configurators"));
Assert.assertEquals("aaa=bbb", config.getConfig("dubbo.properties", "test")); |
@ralf0131 I'm fixing this. Also, I feel happy to help with nacos metadata center imeplement. |
Cool, the estimated release date 2.7.2 is targeting 5.15, will you be able to finish it? If not I can help. |
Yes, I am going to finish this no later than the day after tomorrow :). Actually, if things not going well until tomorrow, I can contact with you. |
...cos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
Outdated
Show resolved
Hide resolved
...cos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
Outdated
Show resolved
Hide resolved
In order to make dubbo-demo work, we also need to add the following code to
|
Another issue I found is, when I create a service configurator via nacos-config, for example, dataId = The reason is, if the namespace is not specified, Dubbo use "dubbo" as a default namespace, while Nacos use empty string "" as default namespace. So what I did is to remove the url that contains parameter "namespace=dubbo". In that case, Nacos will use empty String instead. Below is the change I made to protected DynamicConfiguration createDynamicConfiguration(URL url) {
- return new NacosDynamicConfiguration(url);
+ URL nacosURL = url;
+ if (Constants.DUBBO.equals(url.getParameter(PropertyKeyConst.NAMESPACE))) {
+ // Nacos use empty string as default name space, replace default namespace "dubbo" to ""
+ nacosURL = url.removeParameter(PropertyKeyConst.NAMESPACE);
+ }
+ return new NacosDynamicConfiguration(nacosURL);
} |
Followed by the previous issue, if we configure The reason is in
However, since no group is passed, the Since in service governance configuration, Dubbo will always use "dubbo" as group. What I did is apply the following change to
then everything will work fine. |
Thank you Huxing! What's more, I want to add a util class in dubbo-common for nacos operation, to avoid some duplicated code. I can do this in nacos-metatada pull request. How do you think? |
Yeah, I notice some duplicated code in dubbo-registry-nacos and dubbo-configcenter-nacos. Do you mean that?
Look great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the code looks good to me, thanks for the pull request!
Hi, I have already merged this pull request, looking forward to your metadata report implementation. :-) |
What is the purpose of the change
nacos config-server support
Brief changelog
nacos config-server support
Verifying this change
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.