commit
3994863985
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the BSD 3-Clause License (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://opensource.org/licenses/BSD-3-Clause
|
|
||||||
*
|
|
||||||
* 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 com.tencent.cloud.polaris.circuitbreaker.example;
|
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* service a provider.
|
|
||||||
*
|
|
||||||
* @author Haotian Zhang
|
|
||||||
*/
|
|
||||||
@FeignClient(name = "polaris-circuitbreaker-example-a",
|
|
||||||
fallback = ProviderAFallback.class)
|
|
||||||
public interface ProviderA {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get info of service A.
|
|
||||||
* @return info of service A
|
|
||||||
*/
|
|
||||||
@GetMapping("/example/service/a/info")
|
|
||||||
String info();
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the BSD 3-Clause License (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://opensource.org/licenses/BSD-3-Clause
|
|
||||||
*
|
|
||||||
* 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 com.tencent.cloud.polaris.circuitbreaker.example;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* provider a fallback
|
|
||||||
*
|
|
||||||
* @author Haotian Zhang
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class ProviderAFallback implements ProviderA {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String info() {
|
|
||||||
return "trigger the refuse for service a";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,64 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>spring-cloud-tencent-examples</artifactId>
|
<artifactId>spring-cloud-tencent-examples</artifactId>
|
||||||
<groupId>com.tencent.cloud</groupId>
|
<groupId>com.tencent.cloud</groupId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>polaris-circuitbreaker-example</artifactId>
|
<artifactId>polaris-circuitbreaker-example</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>polaris-circuitbreaker-example-a</module>
|
<module>polaris-circuitbreaker-example-a</module>
|
||||||
<module>polaris-circuitbreaker-example-b</module>
|
<module>polaris-circuitbreaker-example-b</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>spring-cloud-starter-tencent-polaris-discovery</artifactId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<groupId>com.tencent.cloud</groupId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<dependency>
|
||||||
<!-- 系统服务监控依赖 -->
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<dependency>
|
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</dependency>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
</dependencies>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- feign客户端依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 熔断依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 负载均衡依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 熔断超时后,重试机制依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.retry</groupId>
|
|
||||||
<artifactId>spring-retry</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,15 +0,0 @@
|
|||||||
log4j.rootLogger=DEBUG,console,FILE
|
|
||||||
|
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.console.threshold=INFO
|
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
|
|
||||||
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.FILE.Append=true
|
|
||||||
|
|
||||||
log4j.appender.FILE.File=applog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
|
|
||||||
log4j.appender.FILE.Threshold=INFO
|
|
||||||
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
log4j.appender.FILE.MaxFileSize=10MB
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<contextName>logback</contextName>
|
|
||||||
<!--输出到控制台-->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!--按天生成日志-->
|
|
||||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<Prudent>true</Prudent>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<FileNamePattern>
|
|
||||||
applog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
|
|
||||||
</FileNamePattern>
|
|
||||||
</rollingPolicy>
|
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
|
||||||
<Pattern>
|
|
||||||
%d{yyyy-MM-dd HH:mm:ss} -%msg%n
|
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
<appender-ref ref="logFile"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
@ -1,6 +1,10 @@
|
|||||||
global:
|
#global:
|
||||||
system:
|
# system:
|
||||||
discoverCluster:
|
# discoverCluster:
|
||||||
sameAsBuiltin: true
|
# sameAsBuiltin: false
|
||||||
healthCheckCluster:
|
# namespace: Polaris
|
||||||
sameAsBuiltin: true
|
# service: polaris.discover
|
||||||
|
# healthCheckCluster:
|
||||||
|
# sameAsBuiltin: false
|
||||||
|
# namespace: Polaris
|
||||||
|
# service: polaris.healthcheck
|
||||||
|
4
spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceCallback.java → spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java
4
spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceCallback.java → spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java
@ -1,15 +0,0 @@
|
|||||||
log4j.rootLogger=DEBUG,console,FILE
|
|
||||||
|
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.console.threshold=INFO
|
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
|
|
||||||
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.FILE.Append=true
|
|
||||||
|
|
||||||
log4j.appender.FILE.File=applog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
|
|
||||||
log4j.appender.FILE.Threshold=INFO
|
|
||||||
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
log4j.appender.FILE.MaxFileSize=10MB
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<contextName>logback</contextName>
|
|
||||||
<!--输出到控制台-->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!--按天生成日志-->
|
|
||||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<Prudent>true</Prudent>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<FileNamePattern>
|
|
||||||
applog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
|
|
||||||
</FileNamePattern>
|
|
||||||
</rollingPolicy>
|
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
|
||||||
<Pattern>
|
|
||||||
%d{yyyy-MM-dd HH:mm:ss} -%msg%n
|
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
<appender-ref ref="logFile"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
@ -1,65 +1,38 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>spring-cloud-tencent-examples</artifactId>
|
<artifactId>spring-cloud-tencent-examples</artifactId>
|
||||||
<groupId>com.tencent.cloud</groupId>
|
<groupId>com.tencent.cloud</groupId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>polaris-discovery-example</artifactId>
|
<artifactId>polaris-discovery-example</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Spring Cloud Starter Tencent Polaris Discovery Example</name>
|
<name>Spring Cloud Starter Tencent Polaris Discovery Example</name>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>discovery-callee-service</module>
|
<module>discovery-callee-service</module>
|
||||||
<module>discovery-caller-service</module>
|
<module>discovery-caller-service</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 系统服务监控依赖 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- feign客户端依赖 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 熔断依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 负载均衡依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 熔断超时后,重试机制依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.retry</groupId>
|
|
||||||
<artifactId>spring-retry</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -1,15 +0,0 @@
|
|||||||
log4j.rootLogger=DEBUG,console,FILE
|
|
||||||
|
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.console.threshold=INFO
|
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
|
|
||||||
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
|
|
||||||
log4j.appender.FILE.Append=true
|
|
||||||
|
|
||||||
log4j.appender.FILE.File=applog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
|
|
||||||
log4j.appender.FILE.Threshold=INFO
|
|
||||||
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} [%5p] - %c -%F(%L) -%m%n
|
|
||||||
log4j.appender.FILE.MaxFileSize=10MB
|
|
@ -1 +1,2 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.tencent.cloud.polaris.context.PolarisContextConfiguration
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
com.tencent.cloud.polaris.context.PolarisContextConfiguration
|
||||||
|
Loading…
Reference in new issue