[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16356765#comment-16356765 ] ASF GitHub Bot commented on SCB-315: WillemJiang closed pull request #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java index 1b1a80481..90f3865da 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java @@ -109,8 +109,9 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration private static List getStringListProperty(Configuration configSource, List defaultValue, String... keys) { +configSource = guardConfigSource(configSource); if (configSource == null) { - configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource(); + return defaultValue; } for (String key : keys) { String[] vals = configSource.getStringArray(key); @@ -122,8 +123,9 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration } private static int getPositiveIntProperty(Configuration configSource, int defaultValue, String... keys) { +configSource = guardConfigSource(configSource); if (configSource == null) { - configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource(); + return defaultValue; } for (String key : keys) { Integer val = configSource.getInteger(key, null); @@ -140,8 +142,9 @@ private static int getPositiveIntProperty(Configuration configSource, int defaul private static boolean getBooleanProperty(Configuration configSource, boolean defaultValue, String... keys) { +configSource = guardConfigSource(configSource); if (configSource == null) { - configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource(); + return defaultValue; } for (String key : keys) { Boolean val = configSource.getBoolean(key, null); @@ -151,4 +154,11 @@ private static boolean getBooleanProperty(Configuration configSource, boolean de } return defaultValue; } + + private static Configuration guardConfigSource(Configuration configSource) { +if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) { + configSource = (Configuration) DynamicPropertyFactory.getBackingConfigurationSource(); +} +return configSource; + } } 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16356636#comment-16356636 ] ASF GitHub Bot commented on SCB-315: liubao68 commented on a change in pull request #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549#discussion_r165809804 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -109,9 +109,12 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration private static List getStringListProperty(Configuration configSource, List defaultValue, String... keys) { -if (configSource == null) { +if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) { Review comment: 这种情况属于UT问题,不是代码问题,改代码不合适。 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16355260#comment-16355260 ] ASF GitHub Bot commented on SCB-315: coveralls commented on issue #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549#issuecomment-362792402 [![Coverage Status](https://coveralls.io/builds/15410678/badge)](https://coveralls.io/builds/15410678) Coverage decreased (-0.01%) to 87.257% when pulling **8cf9e93aea0b5e8d94999820ab664ddb9cbf62b9 on jeho0815:Branch_SCB315** into **bbe18e493aa3fb3d1531f7e6bee806e22d9994b4 on apache:master**. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16355186#comment-16355186 ] ASF GitHub Bot commented on SCB-315: jeho0815 commented on a change in pull request #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549#discussion_r166557108 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -109,9 +109,12 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration private static List getStringListProperty(Configuration configSource, List defaultValue, String... keys) { -if (configSource == null) { +if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16352170#comment-16352170 ] ASF GitHub Bot commented on SCB-315: WillemJiang commented on a change in pull request #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549#discussion_r165916277 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -109,9 +109,12 @@ public static AddressResolverOptions getAddressResover(String tag, Configuration private static List getStringListProperty(Configuration configSource, List defaultValue, String... keys) { -if (configSource == null) { +if (configSource == null && DynamicPropertyFactory.getBackingConfigurationSource() != null) { Review comment: There are lot of duplicated code, we could extract a method for it. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351328#comment-16351328 ] ASF GitHub Bot commented on SCB-315: coveralls commented on issue #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549#issuecomment-362792402 [![Coverage Status](https://coveralls.io/builds/15356750/badge)](https://coveralls.io/builds/15356750) Coverage decreased (-0.01%) to 87.257% when pulling **b6a9cd7c99e1009142b022de6a1d000e0188d1ba on jeho0815:Branch_SCB315** into **bbe18e493aa3fb3d1531f7e6bee806e22d9994b4 on apache:master**. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351317#comment-16351317 ] ASF GitHub Bot commented on SCB-315: jeho0815 opened a new pull request #549: [SCB-315] Resolve the Registry-Service UT test fail URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/549 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351263#comment-16351263 ] ASF GitHub Bot commented on SCB-315: WillemJiang closed 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 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java index 306cf7f04..0ca5668e9 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java @@ -147,7 +147,9 @@ private void refreshMembers(MemberDiscovery memberDiscovery) { } }); SignRequest signReq = createSignRequest(request.method().toString(), -configCenter + URIConst.MEMBERS, new HashMap<>(), null); +configCenter + URIConst.MEMBERS, +new HashMap<>(), +null); if (ConfigCenterConfig.INSTANCE.getToken() != null) { request.headers().add("X-Auth-Token", ConfigCenterConfig.INSTANCE.getToken()); } @@ -159,7 +161,8 @@ private void refreshMembers(MemberDiscovery memberDiscovery) { private void deployConfigClient() throws InterruptedException { VertxOptions vertxOptions = new VertxOptions(); - vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY)); + vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY, +ConfigCenterConfig.INSTANCE.getConcurrentCompositeConfiguration())); Vertx vertx = VertxUtils.getOrCreateVertxByName("config-center", vertxOptions); HttpClientOptions httpClientOptions = createHttpClientOptions(); @@ -245,7 +248,9 @@ public void doWatch(String configCenter) authHeaderProviders.forEach(provider -> authHeaders.putAll(provider.getSignAuthHeaders( createSignRequest(null, configCenter + url, headers, null; -client.websocket(refreshPort, ipPort.getHostOrIp(), url, +client.websocket(refreshPort, +ipPort.getHostOrIp(), +url, new CaseInsensitiveHeaders().addAll(headers) .addAll(authHeaders), ws -> { @@ -284,7 +289,9 @@ public void doWatch(String configCenter) private void startHeartBeatThread(WebSocket ws) { heartbeatTask = Executors.newScheduledThreadPool(1); - heartbeatTask.scheduleWithFixedDelay(() -> sendHeartbeat(ws), HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL, + heartbeatTask.scheduleWithFixedDelay(() -> sendHeartbeat(ws), + HEARTBEAT_INTERVAL, + HEARTBEAT_INTERVAL, TimeUnit.MILLISECONDS); } @@ -338,7 +345,9 @@ public void refreshConfig(String configcenter) { request.headers().addAll(headers); authHeaderProviders.forEach(provider -> request.headers() .addAll(provider.getSignAuthHeaders(createSignRequest(request.method().toString(), -configcenter + path, headers, null; +configcenter + path, +headers, +null; request.exceptionHandler(e -> { LOGGER.error("config refresh fail {}", e.getMessage()); }); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java index 698178dba..1b1a80481 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java @@ -20,108 +20,135 @@ import java.util.Arrays; import java.util.List; +import org.apache.commons.configuration.Configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.netflix.config.DynamicPropertyFactory; import io.vertx.core.dns.AddressResolverOptions; public class AddressResolverConfig { + private static final Logger LOGGER = LoggerFactory.getLogger(AddressResolverConfig.class); + /** * get the target endpoints with custom address resolve config * @param tag config tag, such as sc.consumer or cc.consumer * @return AddressResolverOptions */ public static AddressResolverOptions
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351239#comment-16351239 ] ASF GitHub Bot commented on SCB-315: coveralls commented on issue #546: SCB-315 Config Center module can't get config by DynamicPropertyFacto… URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/546#issuecomment-362558547 [![Coverage Status](https://coveralls.io/builds/15355721/badge)](https://coveralls.io/builds/15355721) Coverage decreased (-0.02%) to 87.295% when pulling **4eb6af5cc443593e113fe5e76ed407c50b5f3e5a on jeho0815:Branch_SCB-315** into **769dc9dd52f3c003f763ddaacd5d601a37ed273e on apache:master**. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351227#comment-16351227 ] ASF GitHub Bot commented on SCB-315: wujimin 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_r165803612 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -32,96 +34,113 @@ * @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, Configuration 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."
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351223#comment-16351223 ] 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_r165803480 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -32,96 +34,113 @@ * @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, Configuration 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."
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351222#comment-16351222 ] ASF GitHub Bot commented on SCB-315: wujimin 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_r165803367 ## File path: foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java ## @@ -32,96 +34,113 @@ * @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, Configuration 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."
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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,
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16351180#comment-16351180 ] ASF GitHub Bot commented on SCB-315: wujimin 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_r165799372 ## 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,
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350130#comment-16350130 ] ASF GitHub Bot commented on SCB-315: jeho0815 opened a new 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 …ry.getInstance().getStringProperty, so has to use ConcurrentCompositeConfiguration Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16344496#comment-16344496 ] ASF GitHub Bot commented on SCB-315: WillemJiang closed pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java index 89ff0053c..602f4a921 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java @@ -45,6 +45,7 @@ import org.apache.servicecomb.foundation.ssl.SSLCustom; import org.apache.servicecomb.foundation.ssl.SSLOption; import org.apache.servicecomb.foundation.ssl.SSLOptionFactory; +import org.apache.servicecomb.foundation.vertx.AddressResolverConfig; import org.apache.servicecomb.foundation.vertx.VertxTLSBuilder; import org.apache.servicecomb.foundation.vertx.VertxUtils; import org.apache.servicecomb.foundation.vertx.client.ClientPoolManager; @@ -59,6 +60,7 @@ import io.netty.handler.codec.http.HttpResponseStatus; import io.vertx.core.DeploymentOptions; import io.vertx.core.Vertx; +import io.vertx.core.VertxOptions; import io.vertx.core.http.CaseInsensitiveHeaders; import io.vertx.core.http.HttpClientOptions; import io.vertx.core.http.HttpClientRequest; @@ -152,7 +154,9 @@ private void refreshMembers(MemberDiscovery memberDiscovery) { } private void deployConfigClient() throws InterruptedException { -Vertx vertx = VertxUtils.getOrCreateVertxByName("config-center", null); +VertxOptions vertxOptions = new VertxOptions(); + vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY)); +Vertx vertx = VertxUtils.getOrCreateVertxByName("config-center", vertxOptions); HttpClientOptions httpClientOptions = createHttpClientOptions(); clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions)); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java new file mode 100644 index 0..698178dba --- /dev/null +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.foundation.vertx; + +import java.util.Arrays; +import java.util.List; + +import com.netflix.config.DynamicPropertyFactory; + +import io.vertx.core.dns.AddressResolverOptions; + +public class AddressResolverConfig { + + /** + * get the target endpoints with custom address resolve config + * @param tag config tag, such as sc.consumer or cc.consumer + * @return AddressResolverOptions + */ + public static AddressResolverOptions getAddressResover(String tag) { +AddressResolverOptions addressResolverOptions = new AddressResolverOptions(); +addressResolverOptions + .setServers(getStringListProperty(AddressResolverOptions.DEFAULT_SEACH_DOMAINS, +"addressResolver." + tag + ".servers", +"addressResolver.servers")); +addressResolverOptions + .setOptResourceEnabled(getBooleanProperty(AddressResolverOptions.DEFAULT_OPT_RESOURCE_ENABLED, +"addressResolver." + tag + ".optResourceEnabled", +"addressResolver.optResourceEnabled")); +addressResolverOptions +
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16344370#comment-16344370 ] ASF GitHub Bot commented on SCB-315: coveralls commented on issue #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#issuecomment-361125203 [![Coverage Status](https://coveralls.io/builds/15279650/badge)](https://coveralls.io/builds/15279650) Coverage increased (+0.06%) to 87.491% when pulling **1a5444be0e8c66ef3afcd3281ac18b0ac030c31c on jeho0815:SCB-315** into **8e84b30ad678eed7616d2fc38540feaf66d579f2 on apache:master**. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16344330#comment-16344330 ] ASF GitHub Bot commented on SCB-315: jeho0815 commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164614053 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16344329#comment-16344329 ] ASF GitHub Bot commented on SCB-315: jeho0815 commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164614034 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1"); Assert.assertEquals("default.svc.local.cluster", aroc1.getSearchDomains().get(0)); 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16344328#comment-16344328 ] ASF GitHub Bot commented on SCB-315: jeho0815 commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164614020 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1"); 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16343448#comment-16343448 ] ASF GitHub Bot commented on SCB-315: WillemJiang commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164455281 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1"); Review comment: Please use assertThat here. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16343445#comment-16343445 ] ASF GitHub Bot commented on SCB-315: WillemJiang commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164455177 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1"); Assert.assertEquals("default.svc.local.cluster", aroc1.getSearchDomains().get(0)); Review comment: Please use assertThat here. 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)
[jira] [Commented] (SCB-315) As a SDK user, i want to custom netty dns resovl properties so that the ServiceComb has to add config support
[ https://issues.apache.org/jira/browse/SCB-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16343446#comment-16343446 ] ASF GitHub Bot commented on SCB-315: WillemJiang commented on a change in pull request #538: SCB-315 add common AddressResover configuration to foundation-vertx, and use it in service-registry and config-cc to support dynamic config by user URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/538#discussion_r164454843 ## File path: foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestAddressResoverConfig.java ## @@ -40,8 +61,7 @@ public void testGetResover() { ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); -Assert.assertEquals(2, aroc.getServers().size()); -Assert.assertEquals("8.8.8.8", aroc.getServers().get(0)); +Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals("test.svc.local.cluster", aroc.getSearchDomains().get(0)); Review comment: This line can be changed to use assertThat. 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)