diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml
similarity index 91%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml
index 01dd7904a..e1ee856b3 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml
@@ -10,8 +10,8 @@
4.0.0
- polaris-circuitbreaker-example-b
- Polaris Circuit Breaker Example B
+ polaris-circuitbreaker-callee-service
+ Polaris Circuit Breaker Callee Example
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceB.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceB.java
similarity index 100%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceB.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceB.java
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java
similarity index 100%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml
similarity index 80%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/resources/bootstrap.yml
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml
index dfdcb3bb9..1e3a197ce 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml
@@ -2,7 +2,7 @@ server:
port: 48081
spring:
application:
- name: polaris-circuitbreaker-example-b
+ name: polaris-circuitbreaker-callee-service
cloud:
polaris:
address: grpc://127.0.0.1:8091
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml
similarity index 92%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml
index 340de2286..152aeef96 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml
@@ -10,7 +10,8 @@
4.0.0
- polaris-circuitbreaker-example-b2
+ polaris-circuitbreaker-callee-service2
+ Polaris Circuit Breaker Callee Example 2
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceB2.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceB2.java
similarity index 100%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceB2.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceB2.java
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java
similarity index 100%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml
similarity index 80%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/resources/bootstrap.yml
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml
index 240710181..d18fd1bc9 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b2/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml
@@ -2,7 +2,7 @@ server:
port: 48082
spring:
application:
- name: polaris-circuitbreaker-example-b
+ name: polaris-circuitbreaker-callee-service
cloud:
polaris:
address: grpc://127.0.0.1:8091
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallbackConstant.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallbackConstant.java
deleted file mode 100644
index 3c1f34a66..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallbackConstant.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.tencent.cloud.polaris.circuitbreaker.example;
-
-public class ProviderBFallbackConstant {
-
- public static final String SERVICE_NAME = "polaris-circuitbreaker-example-b";
-
- public static final String API = "/example/service/b/info";
-
- public static final String FALLBACK_MESSAGE = "trigger the refuse for service b";
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceAController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceAController.java
deleted file mode 100644
index b22c7dd8c..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceAController.java
+++ /dev/null
@@ -1,107 +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 reactor.core.publisher.Mono;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
-import org.springframework.cloud.client.circuitbreaker.ReactiveCircuitBreakerFactory;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.reactive.function.client.WebClient;
-
-/**
- * Circuit breaker example caller controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/example/service/a")
-public class ServiceAController {
-
- @Autowired
- private ProviderB polarisServiceB;
-
- @Autowired
- private RestTemplate restTemplate;
-
- @Autowired
- private ReactiveCircuitBreakerFactory reactiveCircuitBreakerFactory;
-
- @Autowired
- private CircuitBreakerFactory circuitBreakerFactory;
-
- @Autowired
- private WebClient.Builder webClientBuilder;
-
- /**
- * Get info of Service B by Feign.
- * @return info of Service B
- */
- @GetMapping("/getBServiceInfo")
- public String getBServiceInfo() {
- return polarisServiceB.info();
- }
-
- @GetMapping("/getBServiceInfoByRestTemplate1")
- public String getBServiceInfoByRestTemplate1() {
- return restTemplate.getForObject(ProviderBFallbackConstant.API, String.class);
- }
-
- @GetMapping("/getBServiceInfoByRestTemplate")
- public String getBServiceInfoByRestTemplate() {
- return circuitBreakerFactory
- .create(ProviderBFallbackConstant.SERVICE_NAME)
- .run(() ->
- restTemplate.getForObject(ProviderBFallbackConstant.API, String.class),
- throwable -> ProviderBFallbackConstant.FALLBACK_MESSAGE
- );
- }
-
- @GetMapping("/getBServiceInfoByWebClient")
- public Mono getBServiceInfoByWebClient() {
- return webClientBuilder
- .build()
- .get()
- .uri(ProviderBFallbackConstant.API)
- .retrieve()
- .bodyToMono(String.class)
- .transform(it ->
- reactiveCircuitBreakerFactory
- .create(ProviderBFallbackConstant.SERVICE_NAME)
- .run(it, throwable -> Mono.just(ProviderBFallbackConstant.FALLBACK_MESSAGE))
- );
- }
-
- /**
- * Get info of Service B by RestTemplate.
- * @return info of Service B
- */
- @GetMapping("/testRest")
- public String testRest() {
- ResponseEntity entity = restTemplate.getForEntity(
- "http://polaris-circuitbreaker-example-b/example/service/b/info",
- String.class);
- return entity.getBody();
- }
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/bootstrap.yml
deleted file mode 100644
index 1010c99b2..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-server:
- port: 48080
-spring:
- application:
- name: polaris-circuitbreaker-example-a
- cloud:
- polaris:
- address: grpc://127.0.0.1:8091
- namespace: default
- enabled: true
- circuitbreaker:
- enabled: true
- stat:
- enabled: true
- port: 28081
- loadbalancer:
- configurations: polaris
- tencent:
- rpc-enhancement:
- enabled: true
- reporter:
- ignore-internal-server-error: true
- series: server_error
- statuses: gateway_timeout, bad_gateway, service_unavailable
-
-feign:
- circuitbreaker:
- enabled: true
- compression:
- request:
- enabled: false
- mime-types: text/xml,application/xml,application/json
- min-request-size: 2048
- response:
- enabled: false
-
-serivceB:
- url: http://localhost:48081
-logging:
- level:
- root: info
- com.tencent.cloud: debug
-
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml
similarity index 88%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml
index a20045728..6f7382e7b 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml
@@ -10,8 +10,8 @@
4.0.0
- polaris-circuitbreaker-example-a
- Polaris Circuit Breaker Example A
+ polaris-circuitbreaker-feign-example
+ Polaris Circuit Breaker Feign Example
@@ -19,11 +19,6 @@
spring-boot-starter-web
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
com.tencent.cloud
spring-cloud-starter-tencent-polaris-discovery
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java
similarity index 83%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java
index 7fa0830c6..5e1160877 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderB.java
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.example;
+package com.tencent.cloud.polaris.circuitbreaker.feign.example;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
@@ -24,10 +24,10 @@ import org.springframework.web.bind.annotation.GetMapping;
/**
* Circuit breaker example callee provider.
*
- * @author Haotian Zhang
+ * @author sean yu
*/
@Primary
-@FeignClient(name = ProviderBFallbackConstant.SERVICE_NAME, fallback = ProviderBFallback.class)
+@FeignClient(name = "polaris-circuitbreaker-callee-service", fallback = ProviderBFallback.class)
public interface ProviderB {
/**
@@ -35,6 +35,6 @@ public interface ProviderB {
*
* @return info of service B
*/
- @GetMapping(ProviderBFallbackConstant.API)
+ @GetMapping("/example/service/b/info")
String info();
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java
similarity index 87%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java
index cb015bbe0..e62cbf24c 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ProviderBFallback.java
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java
@@ -15,20 +15,20 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.example;
+package com.tencent.cloud.polaris.circuitbreaker.feign.example;
import org.springframework.stereotype.Component;
/**
* Circuit breaker example callee fallback.
*
- * @author Haotian Zhang
+ * @author sean yu
*/
@Component
public class ProviderBFallback implements ProviderB {
@Override
public String info() {
- return ProviderBFallbackConstant.FALLBACK_MESSAGE;
+ return "fallback: trigger the refuse for service b";
}
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAController.java
new file mode 100644
index 000000000..5c7108716
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAController.java
@@ -0,0 +1,47 @@
+/*
+ * 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.feign.example;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Circuit breaker example caller controller.
+ *
+ * @author sean yu
+ */
+@RestController
+@RequestMapping("/example/service/a")
+public class ServiceAController {
+
+ @Autowired
+ private ProviderB polarisServiceB;
+
+ /**
+ * Get info of Service B by Feign.
+ * @return info of Service B
+ */
+ @GetMapping("/getBServiceInfo")
+ public String getBServiceInfo() {
+ return polarisServiceB.info();
+ }
+
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAFeign.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAFeign.java
new file mode 100644
index 000000000..f6a012bb0
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAFeign.java
@@ -0,0 +1,38 @@
+/*
+ * 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.feign.example;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+/**
+ * Circuit breaker example caller application.
+ *
+ * @author sean yu
+ */
+@SpringBootApplication
+@EnableFeignClients
+public class ServiceAFeign {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ServiceAFeign.class, args);
+ }
+
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/resources/bootstrap.yml
new file mode 100644
index 000000000..4be0448df
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/resources/bootstrap.yml
@@ -0,0 +1,39 @@
+server:
+ port: 48080
+spring:
+ application:
+ name: polaris-circuitbreaker-feign-example
+ cloud:
+ polaris:
+ address: grpc://127.0.0.1:8091
+ namespace: default
+# enabled: true
+# loadbalancer:
+# enabled: true
+# circuitbreaker:
+# enabled: true
+# stat:
+# enabled: true
+# port: 28081
+# tencent:
+# rpc-enhancement:
+# enabled: true
+# reporter:
+# ignore-internal-server-error: true
+# series: server_error
+# statuses: gateway_timeout, bad_gateway, service_unavailable
+
+feign:
+ circuitbreaker:
+ enabled: true
+# compression:
+# request:
+# enabled: false
+# mime-types: text/xml,application/xml,application/json
+# min-request-size: 2048
+
+logging:
+ level:
+ root: info
+ com.tencent.cloud: debug
+
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/pom.xml
new file mode 100644
index 000000000..9064f5b88
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/pom.xml
@@ -0,0 +1,87 @@
+
+
+
+ polaris-circuitbreaker-example
+ com.tencent.cloud
+ ${revision}
+ ../pom.xml
+
+ 4.0.0
+
+ polaris-circuitbreaker-gateway-example
+ Polaris Circuit Breaker Gateway Example
+
+
+
+ spring-cloud-starter-tencent-polaris-discovery
+ com.tencent.cloud
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-circuitbreaker
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-router
+
+
+
+ com.tencent.cloud
+ spring-cloud-tencent-gateway-plugin
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-metadata-transfer
+
+
+
+ com.tencent.cloud
+ spring-cloud-tencent-featureenv-plugin
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-gateway
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.0
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/FallbackController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/FallbackController.java
new file mode 100644
index 000000000..c0d964b56
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/FallbackController.java
@@ -0,0 +1,37 @@
+/*
+ * 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.gateway.example;
+
+import reactor.core.publisher.Mono;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * FallbackController.
+ *
+ * sean yu
+ */
+@RestController
+public class FallbackController {
+
+ @GetMapping("/polaris-fallback")
+ Mono getFallback() {
+ return Mono.just("fallback: trigger the refuse for service b");
+ }
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/GatewayScgApplication.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/GatewayScgApplication.java
new file mode 100644
index 000000000..ea042b2f9
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/GatewayScgApplication.java
@@ -0,0 +1,35 @@
+/*
+ * 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.gateway.example;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * SCG application.
+ *
+ * @author sean yu
+ */
+@SpringBootApplication
+public class GatewayScgApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(GatewayScgApplication.class, args);
+ }
+
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/resources/bootstrap.yml
new file mode 100644
index 000000000..2d312d8f3
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/resources/bootstrap.yml
@@ -0,0 +1,59 @@
+server:
+ session-timeout: 1800
+ port: 48080
+spring:
+ application:
+ name: GatewayScgService
+ cloud:
+ tencent:
+ plugin:
+ scg:
+ staining:
+ enabled: true
+ rule-staining:
+ enabled: true
+ router:
+ feature-env:
+ enabled: true
+ polaris:
+ address: grpc://127.0.0.1:8091
+ namespace: default
+ enabled: true
+ gateway:
+ discovery:
+ locator:
+ enabled: true
+ 'predicates[0]':
+ name: Path
+ args:
+ patterns: '''/'' + serviceId + ''/**'''
+ 'filters[0]':
+ name: RewritePath
+ args:
+ regexp: '''/'' + serviceId + ''/(?.*)'''
+ replacement: '''/$\{remaining}'''
+ 'filters[1]':
+ name: CircuitBreaker
+ args:
+ name: 'serviceId'
+ statusCodes: 502
+ fallbackUri: '''forward:/polaris-fallback'''
+# routes:
+# - id: polaris-circuitbreaker-callee-service
+# uri: lb://polaris-circuitbreaker-callee-service
+# predicates:
+# - Path=/polaris-circuitbreaker-callee-service/**
+# filters:
+# - StripPrefix=1
+# - name: CircuitBreaker
+# args:
+# name: polaris-circuitbreaker-callee-service
+# statusCodes: 502
+# fallbackUri: forward:/polaris-fallback
+logging:
+ level:
+ root: info
+ com.tencent.polaris.discovery.client.flow.RegisterFlow: off
+ com.tencent.polaris.plugins.registry.memory.CacheObject: off
+ com.tencent.cloud.polaris.circuitbreaker: debug
+
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/pom.xml
new file mode 100644
index 000000000..f86372777
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/pom.xml
@@ -0,0 +1,72 @@
+
+
+
+ polaris-circuitbreaker-example
+ com.tencent.cloud
+ ${revision}
+ ../pom.xml
+
+ 4.0.0
+
+ polaris-circuitbreaker-resttemplate-example
+ Polaris Circuit Breaker RestTemplate Example
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-discovery
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-loadbalancer
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-circuitbreaker
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.0
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAController.java
new file mode 100644
index 000000000..d76816ed1
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAController.java
@@ -0,0 +1,53 @@
+/*
+ * 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.resttemplate.example;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Circuit breaker example caller controller.
+ *
+ * @author sean yu
+ */
+@RestController
+@RequestMapping("/example/service/a")
+public class ServiceAController {
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Autowired
+ private CircuitBreakerFactory circuitBreakerFactory;
+
+ @GetMapping("/getBServiceInfo")
+ public String getBServiceInfo() {
+ return circuitBreakerFactory
+ .create("polaris-circuitbreaker-callee-service#/example/service/b/info")
+ .run(() ->
+ restTemplate.getForObject("/example/service/b/info", String.class),
+ throwable -> "trigger the refuse for service b"
+ );
+ }
+
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAResTemplate.java
similarity index 73%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java
rename to spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAResTemplate.java
index 12876cf95..21e2f4778 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceA.java
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAResTemplate.java
@@ -16,43 +16,34 @@
*
*/
-package com.tencent.cloud.polaris.circuitbreaker.example;
+package com.tencent.cloud.polaris.circuitbreaker.resttemplate.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
-import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
-import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.DefaultUriBuilderFactory;
/**
* Circuit breaker example caller application.
*
- * @author Haotian Zhang
+ * @author sean yu
*/
@SpringBootApplication
-@EnableFeignClients
-public class ServiceA {
+public class ServiceAResTemplate {
public static void main(String[] args) {
- SpringApplication.run(ServiceA.class, args);
+ SpringApplication.run(ServiceAResTemplate.class, args);
}
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
- DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://" + ProviderBFallbackConstant.SERVICE_NAME);
+ DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://polaris-circuitbreaker-callee-service");
RestTemplate restTemplate = new RestTemplate();
restTemplate.setUriTemplateHandler(uriBuilderFactory);
return restTemplate;
}
- @LoadBalanced
- @Bean
- WebClient.Builder webClientBuilder() {
- return WebClient.builder()
- .baseUrl("http://" + ProviderBFallbackConstant.SERVICE_NAME);
- }
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/resources/bootstrap.yml
new file mode 100644
index 000000000..d55f55bef
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/resources/bootstrap.yml
@@ -0,0 +1,30 @@
+server:
+ port: 48080
+spring:
+ application:
+ name: polaris-circuitbreaker-resttemplate-example
+ cloud:
+ polaris:
+ address: grpc://127.0.0.1:8091
+ namespace: default
+ enabled: true
+ loadbalancer:
+ enabled: true
+ circuitbreaker:
+ enabled: true
+# stat:
+# enabled: true
+# port: 28081
+# tencent:
+# rpc-enhancement:
+# enabled: true
+# reporter:
+# ignore-internal-server-error: true
+# series: server_error
+# statuses: gateway_timeout, bad_gateway, service_unavailable
+
+logging:
+ level:
+ root: info
+ com.tencent.cloud: debug
+
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/pom.xml
new file mode 100644
index 000000000..3305c2c58
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/pom.xml
@@ -0,0 +1,72 @@
+
+
+
+ polaris-circuitbreaker-example
+ com.tencent.cloud
+ ${revision}
+ ../pom.xml
+
+ 4.0.0
+
+ polaris-circuitbreaker-webclient-example
+ Polaris Circuit Breaker WebClient Example
+
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-discovery
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-loadbalancer
+
+
+
+ com.tencent.cloud
+ spring-cloud-starter-tencent-polaris-circuitbreaker
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.0
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAController.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAController.java
new file mode 100644
index 000000000..72f3c80d5
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAController.java
@@ -0,0 +1,59 @@
+/*
+ * 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.webclient.example;
+
+import reactor.core.publisher.Mono;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.client.circuitbreaker.ReactiveCircuitBreakerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.reactive.function.client.WebClient;
+
+/**
+ * Circuit breaker example caller controller.
+ *
+ * @author sean yu
+ */
+@RestController
+@RequestMapping("/example/service/a")
+public class ServiceAController {
+
+ @Autowired
+ private ReactiveCircuitBreakerFactory reactiveCircuitBreakerFactory;
+
+ @Autowired
+ private WebClient.Builder webClientBuilder;
+
+ @GetMapping("/getBServiceInfo")
+ public Mono getBServiceInfo() {
+ return webClientBuilder
+ .build()
+ .get()
+ .uri("/example/service/b/info")
+ .retrieve()
+ .bodyToMono(String.class)
+ .transform(it ->
+ reactiveCircuitBreakerFactory
+ .create("polaris-circuitbreaker-callee-service#/example/service/b/info")
+ .run(it, throwable -> Mono.just("fallback: trigger the refuse for service b"))
+ );
+ }
+
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAWebClient.java b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAWebClient.java
new file mode 100644
index 000000000..8104ae873
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAWebClient.java
@@ -0,0 +1,45 @@
+/*
+ * 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.webclient.example;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.reactive.function.client.WebClient;
+
+/**
+ * Circuit breaker example caller application.
+ *
+ * @author sean yu
+ */
+@SpringBootApplication
+public class ServiceAWebClient {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ServiceAWebClient.class, args);
+ }
+
+ @LoadBalanced
+ @Bean
+ WebClient.Builder webClientBuilder() {
+ return WebClient.builder()
+ .baseUrl("http://polaris-circuitbreaker-callee-service");
+ }
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/resources/bootstrap.yml
new file mode 100644
index 000000000..2214999c2
--- /dev/null
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/resources/bootstrap.yml
@@ -0,0 +1,30 @@
+server:
+ port: 48080
+spring:
+ application:
+ name: polaris-circuitbreaker-webclient-example
+ cloud:
+ polaris:
+ address: grpc://127.0.0.1:8091
+ namespace: default
+ enabled: true
+ loadbalancer:
+ enabled: true
+ circuitbreaker:
+ enabled: true
+# stat:
+# enabled: true
+# port: 28081
+# tencent:
+# rpc-enhancement:
+# enabled: true
+# reporter:
+# ignore-internal-server-error: true
+# series: server_error
+# statuses: gateway_timeout, bad_gateway, service_unavailable
+
+logging:
+ level:
+ root: info
+ com.tencent.cloud: debug
+
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml
index 6b5daa263..8e53f8d77 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml
+++ b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml
@@ -15,8 +15,11 @@
pom
- polaris-circuitbreaker-example-a
- polaris-circuitbreaker-example-b
- polaris-circuitbreaker-example-b2
+ polaris-circuitbreaker-feign-example
+ polaris-circuitbreaker-gateway-example
+ polaris-circuitbreaker-resttemplate-example
+ polaris-circuitbreaker-webclient-example
+ polaris-circuitbreaker-callee-service
+ polaris-circuitbreaker-callee-service2