Commit 88d973f3 authored by Jason Song's avatar Jason Song

update client usage

parent 54c084f2
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
Config config = ConfigService.getAppConfig(); Config config = ConfigService.getAppConfig();
String someKey = "someKeyFromDefaultNamespace"; String someKey = "someKeyFromDefaultNamespace";
String someDefaultValue = "someDefaultValueForTheKey"; String someDefaultValue = "someDefaultValueForTheKey";
System.out.println(config.getProperty(someKey, someDefaultValue)); System.out.println(String.format("Value for key %s is %s", someKey, config.getProperty(someKey, someDefaultValue)));
``` ```
### 2. Register config change listener ### 2. Register config change listener
...@@ -24,7 +24,7 @@ config.addChangeListener(new ConfigChangeListener() { ...@@ -24,7 +24,7 @@ config.addChangeListener(new ConfigChangeListener() {
System.out.println("Changes for namespace " + changeEvent.getNamespace()); System.out.println("Changes for namespace " + changeEvent.getNamespace());
for (String key : changeEvent.changedKeys()) { for (String key : changeEvent.changedKeys()) {
ConfigChange change = changeEvent.getChange(key); ConfigChange change = changeEvent.getChange(key);
System.out.println(String.format("Change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType())); System.out.println(String.format("Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType()));
} }
} }
}); });
...@@ -36,5 +36,5 @@ String somePublicNamespace = "CAT"; ...@@ -36,5 +36,5 @@ String somePublicNamespace = "CAT";
Config config = ConfigService.getConfig(somePublicNamespace); Config config = ConfigService.getConfig(somePublicNamespace);
String someKey = "someKeyFromPublicNamespace"; String someKey = "someKeyFromPublicNamespace";
String someDefaultValue = "someDefaultValueForTheKey"; String someDefaultValue = "someDefaultValueForTheKey";
System.out.println(config.getProperty(someKey, someDefaultValue)); System.out.println(String.format("Value for key %s is %s", someKey, config.getProperty(someKey, someDefaultValue)));
``` ```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment