-
Notifications
You must be signed in to change notification settings - Fork 185
feat(dynamic config): implement apollo dynamic config crud methods #1808
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
base: develop
Are you sure you want to change the base?
Conversation
d1bf2ba
to
1b14006
Compare
@@ -0,0 +1,54 @@ | |||
package io.sermant.implement.service.dynamicconfig.apollo.config; |
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.
add copyright for any new files
if ("app.id".equals(name)) { | ||
val = getAppId(); | ||
return StringUtils.isNoneBlank(val) ? val : defaultValue; | ||
} else if ("apollo.access-key.secret".equals(name)) { | ||
val = getAccessKeySecret(); | ||
return StringUtils.isNoneBlank(val) ? val : defaultValue; |
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.
constant string can be extracted
if ("apollo.cluster".equals(name)) { | ||
String c = ApolloProperty.getCluster(); |
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.
constant string
* @since 2025/8/7 | ||
*/ | ||
public class ApolloBufferedClient implements Closeable { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(ApolloBufferedClient.class.getName()); |
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.
use java util logging logger
} catch (ApolloOpenApiException e) { | ||
if (e.getCause() instanceof ApolloOpenApiException) { | ||
ApolloOpenApiException apolloException = (ApolloOpenApiException) e.getCause(); | ||
if (apolloException.getStatus() == 400 || apolloException.getStatus() == 409) { |
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.
define error code or use exists constant code
connection.setReadTimeout(ApolloProperty.getReadTimeout()); | ||
|
||
int responseCode = connection.getResponseCode(); | ||
return responseCode >= 200 && responseCode < 300; |
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.
define response code or use exists constant code
|
||
private final ServiceMeta serviceMeta; | ||
|
||
private final Map<String, List<ConfigChangeListener>> groupListeners = new HashMap<>(); |
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.
use ConcurrentHashMap to avoid multi thread problems
public ApolloDynamicConfigService() { | ||
serviceMeta = ConfigManager.getConfig(ServiceMeta.class); | ||
} |
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.
you can add success logs for operations in methods below
/** | ||
* Check whether the group name is valid | ||
* 1. supports only English and digit characters and three special symbols ('.','-','_') | ||
* 2. not supports single "." or "/", and it cannot end with ".json", ".yml", ".yaml", | ||
* ".xml", or ".properties". | ||
* | ||
* @param namespace group name | ||
* @return true: valid; false: invalid |
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.
remember introduce rules in docs on Sermant website
1b14006
to
f6f1471
Compare
Signed-off-by: chenzhenyang <[email protected]>
f6f1471
to
269b8c2
Compare
support ApolloDynamicConfigService and implement CRUD operations for configs
What type of PR is this?
Feature
What this PR does / why we need it?
Describe it.
Which issue(s) this PR fixes?
Fixes #1806
Does this PR introduce a user-facing change?
No
Checklist