[ 
https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16351183#comment-16351183
 ] 

ASF GitHub Bot commented on SCB-315:
------------------------------------

jeho0815 commented on a change in pull request #546: SCB-315 Config Center 
module can't get config by DynamicPropertyFacto…
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/546#discussion_r165799469
 
 

 ##########
 File path: 
foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
 ##########
 @@ -32,58 +33,89 @@
    * @return AddressResolverOptions
    */
   public static AddressResolverOptions getAddressResover(String tag) {
+    return getAddressResover(tag, null);
+  }
+
+  /**
+   * get the target endpoints with custom address resolve config
+   * @param tag config tag, such as sc.consumer or cc.consumer
+   * @param configSource get config from special config source
+   * @return AddressResolverOptions
+   */
+  public static AddressResolverOptions getAddressResover(String tag, 
ConcurrentCompositeConfiguration configSource) {
     AddressResolverOptions addressResolverOptions = new 
AddressResolverOptions();
     addressResolverOptions
-        
.setServers(getStringListProperty(AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
+        .setServers(getStringListProperty(configSource,
+            AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
             "addressResolver." + tag + ".servers",
             "addressResolver.servers"));
     addressResolverOptions
-        
.setOptResourceEnabled(getBooleanProperty(AddressResolverOptions.DEFAULT_OPT_RESOURCE_ENABLED,
+        .setOptResourceEnabled(getBooleanProperty(configSource,
+            AddressResolverOptions.DEFAULT_OPT_RESOURCE_ENABLED,
             "addressResolver." + tag + ".optResourceEnabled",
             "addressResolver.optResourceEnabled"));
     addressResolverOptions
-        
.setCacheMinTimeToLive(getIntProperty(AddressResolverOptions.DEFAULT_CACHE_MIN_TIME_TO_LIVE,
+        .setCacheMinTimeToLive(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_CACHE_MIN_TIME_TO_LIVE,
             "addressResolver." + tag + ".cacheMinTimeToLive",
             "addressResolver.cacheMinTimeToLive"));
     addressResolverOptions
-        
.setCacheMaxTimeToLive(getIntProperty(AddressResolverOptions.DEFAULT_CACHE_MAX_TIME_TO_LIVE,
+        .setCacheMaxTimeToLive(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_CACHE_MAX_TIME_TO_LIVE,
             "addressResolver." + tag + ".cacheMaxTimeToLive",
             "addressResolver.cacheMaxTimeToLive"));
     addressResolverOptions
-        
.setCacheNegativeTimeToLive(getIntProperty(AddressResolverOptions.DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE,
+        .setCacheNegativeTimeToLive(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE,
             "addressResolver." + tag + ".cacheNegativeTimeToLive",
             "addressResolver.cacheNegativeTimeToLive"));
     addressResolverOptions
-        
.setQueryTimeout(getIntProperty(AddressResolverOptions.DEFAULT_QUERY_TIMEOUT,
+        .setQueryTimeout(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_QUERY_TIMEOUT,
             "addressResolver." + tag + ".queryTimeout",
             "addressResolver.queryTimeout"));
     addressResolverOptions
-        
.setMaxQueries(getIntProperty(AddressResolverOptions.DEFAULT_MAX_QUERIES,
+        .setMaxQueries(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_MAX_QUERIES,
             "addressResolver." + tag + ".maxQueries",
             "addressResolver.maxQueries"));
     addressResolverOptions
-        .setRdFlag(getBooleanProperty(AddressResolverOptions.DEFAULT_RD_FLAG,
+        .setRdFlag(getBooleanProperty(configSource,
+            AddressResolverOptions.DEFAULT_RD_FLAG,
             "addressResolver." + tag + ".rdFlag",
             "addressResolver.rdFlag"));
     addressResolverOptions
-        
.setSearchDomains(getStringListProperty(AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
+        .setSearchDomains(getStringListProperty(configSource,
+            AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
             "addressResolver." + tag + ".searchDomains",
             "addressResolver.searchDomains"));
     addressResolverOptions
-        
.setNdots(getIntProperty(AddressResolverOptions.DEFAULT_CACHE_MIN_TIME_TO_LIVE,
+        .setNdots(getIntProperty(configSource,
+            AddressResolverOptions.DEFAULT_CACHE_MIN_TIME_TO_LIVE,
             "addressResolver." + tag + ".ndots",
             "addressResolver.ndots"));
     addressResolverOptions
-        
.setRotateServers(getBooleanProperty(AddressResolverOptions.DEFAULT_ROTATE_SERVERS,
+        .setRotateServers(getBooleanProperty(configSource,
+            AddressResolverOptions.DEFAULT_ROTATE_SERVERS,
             "addressResolver." + tag + ".rotateServers",
             "addressResolver.rotateServers"));
     return addressResolverOptions;
   }
 
-  private static List<String> getStringListProperty(List<String> defaultValue, 
String... keys) {
+  private static List<String> 
getStringListProperty(ConcurrentCompositeConfiguration configSource,
+      List<String> defaultValue, String... keys) {
     String property = null;
 
 Review comment:
   ok

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> As a SDK user, i want to custom netty dns resovl properties so that the 
> ServiceComb has to add config support
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: SCB-315
>                 URL: https://issues.apache.org/jira/browse/SCB-315
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>          Components: Java-Chassis
>    Affects Versions: java-chassis-1.0.0-m1
>            Reporter: jeho0815
>            Assignee: jeho0815
>            Priority: Major
>
> Default DNS resovl use the machine config, but sometimes the application want 
> to set by themselves to adapt to diffrent local or cloud enviroments



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to