You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/01/26 03:52:10 UTC

[GitHub] WillemJiang commented on a change in pull request #394: [SCB-1128] Omega discovers alpha service from eureka

WillemJiang commented on a change in pull request #394: [SCB-1128] Omega discovers alpha service from eureka
URL: https://github.com/apache/servicecomb-pack/pull/394#discussion_r251187016
 
 

 ##########
 File path: omega/omega-spring-starter/src/main/java/org/apache/servicecomb/pack/omega/spring/OmegaSpringConfig.java
 ##########
 @@ -77,20 +86,28 @@ ParametersContext parametersContext() {
     return new DefaultParametersContext();
   }
 
+  @Bean
+  @ConditionalOnProperty(name = "alpha.cluster.register.type", havingValue = "default", matchIfMissing = true)
+  AlphaClusterDiscovery alphaClusterAddress(@Value("${alpha.cluster.address:localhost:8080}") String[] addresses){
+    return AlphaClusterDiscovery.builder().addresses(addresses).build();
+  }
+
   @Bean
   AlphaClusterConfig alphaClusterConfig(
-      @Value("${alpha.cluster.address:localhost:8080}") String[] addresses,
       @Value("${alpha.cluster.ssl.enable:false}") boolean enableSSL,
       @Value("${alpha.cluster.ssl.mutualAuth:false}") boolean mutualAuth,
       @Value("${alpha.cluster.ssl.cert:client.crt}") String cert,
       @Value("${alpha.cluster.ssl.key:client.pem}") String key,
       @Value("${alpha.cluster.ssl.certChain:ca.crt}") String certChain,
+      @Lazy AlphaClusterDiscovery alphaClusterDiscovery,
       @Lazy MessageHandler handler,
       @Lazy TccMessageHandler tccMessageHandler) {
 
+    LOG.info("Discovery alpha cluster address from {} {}",alphaClusterDiscovery.getDiscoveryType().name()
+            ,alphaClusterDiscovery.getDiscoveryInfo() == null ? "" : alphaClusterDiscovery.getDiscoveryInfo());
     MessageFormat messageFormat = new KryoMessageFormat();
     AlphaClusterConfig clusterConfig = AlphaClusterConfig.builder()
-        .addresses(ImmutableList.copyOf(addresses))
+        .addresses(ImmutableList.copyOf(alphaClusterDiscovery.getAddresses()))
 
 Review comment:
   How can we implement the dynamic address lookup? I think we need to add the alphaClusterDiscovery address 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:
users@infra.apache.org


With regards,
Apache Git Services