-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat UrlResolver #4546
feat UrlResolver #4546
Conversation
Hi @xmgdtc, Thank you for opening a PR! So this feature would make it possible to change the -Daniel |
i have completed and signed this agreement thank you for your review |
Hi @xmgdtc, |
The conflict has been resolved |
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.
Hi again @xmgdtc,
Thanks again for your contribution! I have now reviewed it and left some comments for you. Most of them are just small spelling issues and two missing license headers, the main logical adjustment that needs made is to address the null/empty check for the baseURL
here and my question regarding the correct class checked here.
Additionally to the comments, I have these requests:
-
You mentioned that you have signed the license agreement but that doesn't seem to have gone through as its still marked as unsigned, can you please have another look here and sign again?
-
Can you please add test coverage for this new implementation, note we have some testing best practices documented here
Once the comments and the above are implemented I will do another re review.
Thank you, and please let me know if you have any questions.
Helene
@@ -34,11 +34,45 @@ public interface ExternalTaskClientBuilder { | |||
/** | |||
* Base url of the Camunda BPM Platform REST API. This information is mandatory. | |||
* | |||
* if use this method, it will create a permanent url resolver with the given baseUrl |
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.
Small grammar improvement:
* if use this method, it will create a permanent url resolver with the given baseUrl | |
* If this method is used, it will create a permanent url resolver with the given baseUrl. |
* @param baseUrl of the Camunda BPM Platform REST API | ||
* @return the builder | ||
*/ | ||
ExternalTaskClientBuilder baseUrl(String baseUrl); | ||
|
||
|
||
/** | ||
* url resovler of the Camunda BPM Platform REST API. This information is mandatory. |
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.
Typo:
* url resovler of the Camunda BPM Platform REST API. This information is mandatory. | |
* Url resolver of the Camunda BPM Platform REST API. This information is mandatory. |
/** | ||
* url resovler of the Camunda BPM Platform REST API. This information is mandatory. | ||
* | ||
* if the server is ther cluster or you are using spring cloud. you can create a class implements UrlResolver |
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.
Grammar/Spelling improvements:
* if the server is ther cluster or you are using spring cloud. you can create a class implements UrlResolver | |
* If the server is in a cluster or you are using spring cloud, you can create a class which implements UrlResolver. |
package org.camunda.bpm.client; | ||
|
||
/** | ||
* get service url from camunda server |
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.
Small:
* get service url from camunda server | |
* Get service url of the Camunda server |
|
||
|
||
|
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.
🔧 Nit: we can reduce these newlines
if (this.urlResolver instanceof PermanentUrlResolver) { | ||
((PermanentUrlResolver) this.urlResolver).setBaseUrl(sanitizeUrl(this.urlResolver.getBaseUrl())); | ||
} |
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.
❓ According to the javadoc added above, I believe we're expecting urlResolver
to be an instance of UrlResolver
, not necessarily PermanentUrlResolver
. Can we please adjust this check accordingly, or let me know if I'm misunderstanding 🤔
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.
On branch master this method is like blow,i thought it is used for replacing "/" from the baseUrl. but when useing random loadbalance we can`t fight out all the urls. so i kept the logic, when it is a permanent address, still call this method. if not ,developer should resolve by themself
protected void initBaseUrl() {
baseUrl = sanitizeUrl(baseUrl);
}
protected String sanitizeUrl(String url) {
url = url.trim();
if (url.endsWith("/")) {
url = url.replaceAll("/$", "");
url = sanitizeUrl(url);
}
return url;
}
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.
Ah right, so this is just the default sanitation when using the PermanentUrlResolver right?
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.
Yes i kept this logic so that the people who using the regular baseUrl String won`t need to change anything
import org.camunda.bpm.client.UrlResolver; | ||
|
||
/** | ||
* urlResolver with permanent address |
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.
🔧 Nit
* urlResolver with permanent address | |
* UrlResolver with permanent address |
* | ||
* this is a sample for spring cloud DiscoveryClient | ||
* | ||
* public class CustomUrlResolver implements UrlResolver{ |
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.
👍 Nice to have an example included here
@@ -0,0 +1,9 @@ | |||
package org.camunda.bpm.client; |
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.
This file is missing the licenseHeader, can you please add it to the top of this file. You can copy it from one of the other files
@@ -0,0 +1,24 @@ | |||
package org.camunda.bpm.client.impl; |
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.
This file also needs the license header added to it
@PHWaechtler I finished fixing spilling and licenseHeaders. sorry for my bad english. i tried to write a test method. but unfortunately i can`t download all the dependencies with my internet . so i am not sure this test works. but i try this code in my project and it is works |
Hi again @xmgdtc, |
Hi @xmgdtc , just pinging again to make sure you saw this request. Please have a look so that the CLA can be signed, otherwise we cannot progress with this PR. Thans! |
…ss so that we can use load balance address
# Conflicts: # clients/java/client/src/main/java/org/camunda/bpm/client/impl/EngineClient.java
Hi @PHWaechtler , I rebased and commited again. Sorry for keep you waiting for so long beacuse i got a fever last week . |
Hi @xmgdtc , |
Hi @xmgdtc, just writing to let you know we have reviewed merged the PR with your feature so I will close this one now. Thanks for your contribution! |
1 use UrlResolver class to replace baseUrl string in ExternalTaskClientBuilder.class so that we can control how to get the address such as use load balance