feat:support consul service update task. (#1397)

Co-authored-by: andrew shan <45474304+andrewshan@users.noreply.github.com>
Co-authored-by: Haotian Zhang <skyebefreeman@qq.com>
pull/1400/head
Fishtail 3 months ago committed by GitHub
parent dc59a9a3ba
commit 95b708289e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -18,4 +18,5 @@
- [fix:fix the ratelimit bug](https://github.com/Tencent/spring-cloud-tencent/pull/1389)
- [feat:add Tencent Cloud TSF support.](https://github.com/Tencent/spring-cloud-tencent/pull/1391)
- [feat:support consul config.](https://github.com/Tencent/spring-cloud-tencent/pull/1394)
- [feat:add trace report support.](https://github.com/Tencent/spring-cloud-tencent/pull/1396)
- [feat:add trace report support.](https://github.com/Tencent/spring-cloud-tencent/pull/1396)
- [feat:support consul service update task.](https://github.com/Tencent/spring-cloud-tencent/pull/1397)

@ -17,9 +17,7 @@
package com.tencent.cloud.polaris.registry;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.polaris.PolarisDiscoveryProperties;
import com.tencent.polaris.api.pojo.ServiceKey;
import com.tencent.polaris.assembly.api.AssemblyAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -73,9 +71,6 @@ public class PolarisAutoServiceRegistration extends AbstractAutoServiceRegistrat
log.debug("Registration disabled.");
return;
}
if (assemblyAPI != null) {
assemblyAPI.initService(new ServiceKey(MetadataContext.LOCAL_NAMESPACE, MetadataContext.LOCAL_SERVICE));
}
super.register();
}

@ -74,7 +74,7 @@
<revision>1.14.0-2020.0.6-SNAPSHOT</revision>
<!-- Polaris SDK version -->
<polaris.version>1.15.7-SNAPSHOT</polaris.version>
<polaris.version>1.15.8-SNAPSHOT</polaris.version>
<!-- Dependencies -->
<guava.version>32.0.1-jre</guava.version>

@ -14,7 +14,17 @@
<dependencies>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-all</artifactId>
<artifactId>spring-cloud-starter-tencent-polaris-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-polaris-config</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-polaris-contract</artifactId>
</dependency>
<dependency>

@ -14,7 +14,17 @@
<dependencies>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-all</artifactId>
<artifactId>spring-cloud-starter-tencent-polaris-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-polaris-config</artifactId>
</dependency>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-polaris-contract</artifactId>
</dependency>
<dependency>

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Objects;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
import com.tencent.polaris.api.config.Configuration;
import com.tencent.polaris.api.control.Destroyable;
import com.tencent.polaris.api.core.ConsumerAPI;
import com.tencent.polaris.api.core.LosslessAPI;
@ -229,9 +230,10 @@ public class PolarisSDKContextManager {
}
}
// init SDKContext
serviceSdkContext = SDKContext.initContextByConfig(properties.configuration(serviceModifierList,
Configuration configuration = properties.configuration(serviceModifierList,
() -> environment.getProperty("spring.cloud.client.ip-address"),
() -> environment.getProperty("spring.cloud.polaris.local-port", Integer.class, 0)));
() -> environment.getProperty("spring.cloud.polaris.local-port", Integer.class, 0));
serviceSdkContext = SDKContext.initContextByConfig(configuration);
serviceSdkContext.init();
// init ProviderAPI
@ -269,10 +271,10 @@ public class PolarisSDKContextManager {
}
}
}));
LOG.info("create Polaris SDK context successfully. properties: {}", properties);
LOG.info("create Polaris SDK context successfully. properties: {}, configuration: {}", properties, configuration);
}
catch (Throwable throwable) {
LOG.error("create Polaris SDK context failed. properties: {}", properties, throwable);
LOG.error("create Polaris SDK context failed. properties: {}, ", properties, throwable);
throw throwable;
}
}
@ -289,14 +291,15 @@ public class PolarisSDKContextManager {
if (null == configSDKContext && CollectionUtils.isNotEmpty(configModifierList)) {
try {
// init config SDKContext
configSDKContext = SDKContext.initContextByConfig(properties.configuration(configModifierList,
Configuration configuration = properties.configuration(configModifierList,
() -> environment.getProperty("spring.cloud.client.ip-address"),
() -> environment.getProperty("spring.cloud.polaris.local-port", Integer.class, 0)));
() -> environment.getProperty("spring.cloud.polaris.local-port", Integer.class, 0));
configSDKContext = SDKContext.initContextByConfig(configuration);
configSDKContext.init();
// add shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread(PolarisSDKContextManager::innerConfigDestroy));
LOG.info("create Polaris config SDK context successfully. properties: {}, ", properties);
LOG.info("create Polaris config SDK context successfully. properties: {}, configuration: {}", properties, configuration);
}
catch (Throwable throwable) {
LOG.error("create Polaris config SDK context failed. properties: {}, ", properties, throwable);

Loading…
Cancel
Save