diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03e9d4887..1d412e2b4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,3 +16,4 @@
- [feat: add metadata transfer for http header via spring.cloud.tencent.metadata.headers.](https://github.com/Tencent/spring-cloud-tencent/pull/1175)
- [fix:remove bcprov-jdk15on dependency.](https://github.com/Tencent/spring-cloud-tencent/pull/1179)
- [feat:support configuration encryption.](https://github.com/Tencent/spring-cloud-tencent/pull/1183)
+- [feat:optimize examples.](https://github.com/Tencent/spring-cloud-tencent/pull/1187)
diff --git a/spring-cloud-starter-tencent-all/pom.xml b/spring-cloud-starter-tencent-all/pom.xml
index fc6470e9a..50908dfa5 100644
--- a/spring-cloud-starter-tencent-all/pom.xml
+++ b/spring-cloud-starter-tencent-all/pom.xml
@@ -49,18 +49,6 @@
com.tencent.cloud
spring-cloud-starter-tencent-polaris-contract
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
diff --git a/spring-cloud-tencent-examples/multiple-discovery-example/multiple-discovery-nacos-example/nacos-discovery-caller/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/multiple-discovery-example/multiple-discovery-nacos-example/nacos-discovery-caller/src/main/resources/bootstrap.yml
index 72ecca940..187df8952 100644
--- a/spring-cloud-tencent-examples/multiple-discovery-example/multiple-discovery-nacos-example/nacos-discovery-caller/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/multiple-discovery-example/multiple-discovery-nacos-example/nacos-discovery-caller/src/main/resources/bootstrap.yml
@@ -15,7 +15,30 @@ spring:
nacos:
discovery:
server-addr: 127.0.0.1:8848
-
+# consul:
+# port: 8500
+# host: 127.0.0.1
+# enabled: true
+# discovery:
+# enabled: true
+# register: true
+# health-check-path: /actuator/health
+# health-check-interval: 10s
+# instance-id: ${spring.application.name}:${server.port}
+# service-name: ${spring.application.name}
+# ip-address: localhost
+# prefer-ip-address: true
+# nacos:
+# enabled: true
+# password: nacos
+# username: nacos
+# context-path: /nacos
+# discovery:
+# enabled: true
+# register-enabled: true
+# group: polaris
+# server-addr: 127.0.0.1:8848
+# cluster-name: polaris
feign:
circuitbreaker:
enabled: true
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README-zh.md b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README-zh.md
deleted file mode 100644
index 30679375a..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README-zh.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Spring Cloud Polaris Circuitbreaker example
-
-## 样例简介
-
-本样例将介绍如何在Spring Cloud项目中使用```spring-cloud-starter-tencent-polaris-circuitbreaker```以使用其各项功能。
-
-本样例包括被调方```polaris-circuitbreaker-callee-service```、```polaris-circuitbreaker-callee-service2```和主调方```polaris-circuitbreaker-feign-example```、```polaris-circuitbreaker-gateway-example```、```polaris-circuitbreaker-webclient-example```。
-
-## 使用说明
-
-### 修改配置
-
-配置如下所示。其中,${ip}和${port}为Polaris后端服务的IP地址与端口号。
-
-```yaml
-spring:
- application:
- name: ${application.name}
- cloud:
- polaris:
- address: ${ip}:${port}
-```
-
-### 启动样例
-
-#### 启动Polaris后端服务
-
-参考[Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)。
-
-#### 启动被调应用
-
-分别启动```polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service```、```polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2```
-
-
-#### 启动主调应用
-
-##### 启动Feign并验证
-
-启动```polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example```。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromPolaris'`, 验证熔断和Polaris-server远程拉取降级。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromCode'`, 验证熔断和代码降级。
-
-##### 启动RestTemplate并验证
-
-启动```polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example```。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromPolaris'`, 验证熔断和Polaris-server远程拉取降级。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromCode'`, 验证熔断和代码降级。
-
-##### 启动WebClient并验证
-
-启动```polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example```。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo'`, 验证熔断和代码降级。
-
-##### 启动SCG并验证
-
-启动```polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example```。
-
-发送请求`curl --location --request GET 'http://127.0.0.1:48080/polaris-circuitbreaker-callee-service/example/service/b/info'`, 验证熔断和代码降级。
-
-修改```polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/resources/bootstrap.yml```。删除本地fallback方法并重启,验证熔断和Polaris-server远程拉取降级。
-
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README.md b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README.md
deleted file mode 100644
index 0c297ef02..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Spring Cloud Polaris Circuitbreaker example
-
-## Example Introduction
-
-This example shows how to use```spring-cloud-starter-tencent-polaris-circuitbreaker```in Spring Cloud project for its features.
-
-This example contains callee-service```polaris-circuitbreaker-callee-service```、```polaris-circuitbreaker-callee-service2```and caller-service```polaris-circuitbreaker-feign-example```、```polaris-circuitbreaker-gateway-example```、```polaris-circuitbreaker-webclient-example```.
-
-## Instruction
-
-### Configuration
-
-The configuration is as the following shows. ${ip} and ${port} are Polaris backend IP address and port number.
-
-```yaml
-spring:
- application:
- name: ${application.name}
- cloud:
- polaris:
- address: ${ip}:${port}
-```
-
-### Launching Example
-
-#### Launching Polaris Backend Service
-
-Reference to [Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)
-
-#### Launching callee service
-
-Launching```polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service```、```polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2```
-
-
-#### Launching caller service
-
-##### Launching Feign and Verify
-
-Launching```polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example```.
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromPolaris'`, Verify circuit breaker and fallback from Polaris-server.
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromCode'`, Verify circuit breaker and fallback from code.
-
-##### Launching RestTemplate and Verify
-
-Launching```polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example```.
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromPolaris'`, Verify circuit breaker and fallback from Polaris-server.
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo/fallbackFromCode'`, Verify circuit breaker and fallback from code.
-
-##### Launching WebClient and Verify
-
-Launching```polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example```。
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/example/service/a/getBServiceInfo'`, Verify circuit breaker and fallback from code.
-
-##### Launching SCG and Verify
-
-Launching```polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example```。
-
-Sending request`curl --location --request GET 'http://127.0.0.1:48080/polaris-circuitbreaker-callee-service/example/service/b/info'`, Verify circuit breaker and fallback from code.
-
-Changing```polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/resources/bootstrap.yml```, delete local fallback and restart, Verify circuit breaker and fallback from Polaris-server.
-
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml
deleted file mode 100644
index e1ee856b3..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- polaris-circuitbreaker-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-circuitbreaker-callee-service
- Polaris Circuit Breaker Callee Example
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
-
-
-
- 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-callee-service/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
deleted file mode 100644
index c8c32bf24..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceB.java
+++ /dev/null
@@ -1,34 +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.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Circuit breaker example callee application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class ServiceB {
-
- public static void main(String[] args) {
- SpringApplication.run(ServiceB.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/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
deleted file mode 100644
index 8628db06a..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/java/com/tencent/cloud/polaris/circuitbreaker/example/ServiceBController.java
+++ /dev/null
@@ -1,55 +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.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Service B Controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/example/service/b")
-public class ServiceBController {
-
- /**
- * Get service information.
- *
- * @return service information
- */
- @GetMapping("/info")
- public String info() {
- return "hello world ! I'm a service B1";
- }
-
- @GetMapping("/health")
- public String health() {
- System.out.println("health check: 200 instance");
- return "hello world ! I'm a service B1";
- }
-
- @GetMapping("/health-svc")
- public String healthsvc() {
- System.out.println("health-svc check: 200 instance");
- return "hello world ! I'm a service B1";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index ffed6a22c..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-server:
- port: 48081
-spring:
- application:
- name: polaris-circuitbreaker-callee-service
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- stat:
- enabled: true
- port: 28082
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml
deleted file mode 100644
index 152aeef96..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- polaris-circuitbreaker-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-circuitbreaker-callee-service2
- Polaris Circuit Breaker Callee Example 2
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/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
deleted file mode 100644
index fb6bdc687..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceB2.java
+++ /dev/null
@@ -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.ciruitbreaker.example;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Circuit breaker example callee application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class ServiceB2 {
-
- public static void main(String[] args) {
- SpringApplication.run(ServiceB2.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/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
deleted file mode 100644
index 2d5287c3a..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/java/com/tencent/cloud/polaris/ciruitbreaker/example/ServiceBController.java
+++ /dev/null
@@ -1,98 +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.ciruitbreaker.example;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.http.HttpStatus;
-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.RequestParam;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Service B Controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/example/service/b")
-public class ServiceBController {
-
- private static final Logger LOG = LoggerFactory.getLogger(ServiceBController.class);
-
- private boolean ifBadGateway = true;
-
- private boolean ifDelay = true;
-
- @GetMapping("/setBadGateway")
- public void setBadGateway(@RequestParam boolean param) {
- if (param) {
- LOG.info("info is set to return HttpStatus.BAD_GATEWAY.");
- }
- else {
- LOG.info("info is set to return HttpStatus.OK.");
- }
- this.ifBadGateway = param;
- }
-
- @GetMapping("/setDelay")
- public void setDelay(@RequestParam boolean param) {
- if (param) {
- LOG.info("info is set to delay 100ms.");
- }
- else {
- LOG.info("info is set to no delay.");
- }
- this.ifDelay = param;
- }
-
- /**
- * Get service information.
- *
- * @return service information
- */
- @GetMapping("/info")
- public ResponseEntity info() throws InterruptedException {
- if (ifBadGateway) {
- return new ResponseEntity<>("failed for call my service", HttpStatus.BAD_GATEWAY);
- }
- if (ifDelay) {
- Thread.sleep(100);
- }
- return new ResponseEntity<>("hello world ! I'm a service B2", HttpStatus.OK);
- }
-
- @GetMapping("/health")
- @ResponseStatus(value = HttpStatus.BAD_GATEWAY, reason = "failed for call my service")
- public String health() {
- System.out.println("health check: 502 instance");
- return "hello world ! I'm a service B1";
- }
-
- @GetMapping("/health-svc")
- @ResponseStatus(value = HttpStatus.BAD_GATEWAY, reason = "failed for call my service")
- public String healthsvc() {
- System.out.println("health-svc check: 502 instance");
- return "hello world ! I'm a service B1";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml
deleted file mode 100644
index 4909643f7..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-callee-service2/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-server:
- port: 48082
-spring:
- application:
- name: polaris-circuitbreaker-callee-service
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- stat:
- enabled: true
- port: 28083
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml
deleted file mode 100644
index a45ce9336..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
- polaris-circuitbreaker-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-circuitbreaker-feign-example
- Polaris Circuit Breaker Feign Example
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
- 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-starter-actuator
-
-
-
-
-
-
- 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-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
deleted file mode 100644
index 30aa94c49..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAController.java
+++ /dev/null
@@ -1,59 +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.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;
-
- @Autowired
- private ProviderBWithFallback providerBWithFallback;
-
- /**
- * Get info of Service B by Feign.
- * @return info of Service B
- */
- @GetMapping("/getBServiceInfo/fallbackFromCode")
- public String getBServiceInfoFallbackFromCode() {
- return providerBWithFallback.info();
- }
-
- /**
- * Get info of Service B by Feign.
- * @return info of Service B
- */
- @GetMapping("/getBServiceInfo/fallbackFromPolaris")
- public String getBServiceInfoFallbackFromPolaris() {
- 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
deleted file mode 100644
index f6a012bb0..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ServiceAFeign.java
+++ /dev/null
@@ -1,38 +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.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
deleted file mode 100644
index 0afe7375d..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-server:
- port: 48080
-spring:
- application:
- name: polaris-circuitbreaker-feign-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- loadbalancer:
- enabled: true
- circuitbreaker:
- enabled: true
-
-feign:
- circuitbreaker:
- enabled: true
-
-logging:
- level:
- root: info
- com.tencent.cloud: debug
-
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-circuit-breaker
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
deleted file mode 100644
index 833f2e51e..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/pom.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
- 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-starter-actuator
-
-
-
-
-
-
- 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/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
deleted file mode 100644
index ea042b2f9..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/GatewayScgApplication.java
+++ /dev/null
@@ -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.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
deleted file mode 100644
index 1c946649c..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-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://119.91.66.223: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:
- # statusCodes 缺省时会自动识别 "5**" 为错误
- # statusCodes: '''404,5**'''
- # fallbackUri 缺省时会在熔断触发后拉取 plaris server 配置的降级作为 response
- 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:
-# statusCodes: 502
-# fallbackUri: forward:/polaris-fallback
-logging:
- level:
- root: info
- com.tencent.polaris.discovery.client.flow.RegisterFlow: off
- com.tencent.polaris.plugins.registry: off
- com.tencent.cloud: debug
-
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-circuit-breaker
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
deleted file mode 100644
index 942c7587f..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- 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-starter-actuator
-
-
-
-
-
-
- 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
deleted file mode 100644
index d17744ce3..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAController.java
+++ /dev/null
@@ -1,74 +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.resttemplate.example;
-
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
-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;
-
-/**
- * Circuit breaker example caller controller.
- *
- * @author sean yu
- */
-@RestController
-@RequestMapping("/example/service/a")
-public class ServiceAController {
-
- @Autowired
- @Qualifier("defaultRestTemplate")
- private RestTemplate defaultRestTemplate;
-
- @Autowired
- @Qualifier("restTemplateFallbackFromPolaris")
- private RestTemplate restTemplateFallbackFromPolaris;
-
- @Autowired
- @Qualifier("restTemplateFallbackFromCode")
- private RestTemplate restTemplateFallbackFromCode;
-
- @Autowired
- private CircuitBreakerFactory circuitBreakerFactory;
-
- @GetMapping("/getBServiceInfo")
- public String getBServiceInfo() {
- return circuitBreakerFactory
- .create("polaris-circuitbreaker-callee-service#/example/service/b/info")
- .run(() ->
- defaultRestTemplate.getForObject("/example/service/b/info", String.class),
- throwable -> "trigger the refuse for service b"
- );
- }
-
- @GetMapping("/getBServiceInfo/fallbackFromPolaris")
- public ResponseEntity getBServiceInfoFallback() {
- return restTemplateFallbackFromPolaris.getForEntity("/example/service/b/info", String.class);
- }
-
- @GetMapping("/getBServiceInfo/fallbackFromCode")
- public ResponseEntity getBServiceInfoFallbackClass() {
- return restTemplateFallbackFromCode.getForEntity("/example/service/b/info", String.class);
- }
-
-}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAResTemplate.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
deleted file mode 100644
index fb6495912..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/ServiceAResTemplate.java
+++ /dev/null
@@ -1,71 +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.resttemplate.example;
-
-import com.tencent.cloud.polaris.circuitbreaker.resttemplate.PolarisCircuitBreaker;
-
-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.client.RestTemplate;
-import org.springframework.web.util.DefaultUriBuilderFactory;
-
-/**
- * Circuit breaker example caller application.
- *
- * @author sean yu
- */
-@SpringBootApplication
-public class ServiceAResTemplate {
-
- public static void main(String[] args) {
- SpringApplication.run(ServiceAResTemplate.class, args);
- }
-
- @Bean
- @LoadBalanced
- public RestTemplate defaultRestTemplate() {
- DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://polaris-circuitbreaker-callee-service");
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setUriTemplateHandler(uriBuilderFactory);
- return restTemplate;
- }
-
- @Bean
- @LoadBalanced
- @PolarisCircuitBreaker
- public RestTemplate restTemplateFallbackFromPolaris() {
- DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://polaris-circuitbreaker-callee-service");
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setUriTemplateHandler(uriBuilderFactory);
- return restTemplate;
- }
-
- @Bean
- @LoadBalanced
- @PolarisCircuitBreaker(fallbackClass = CustomFallback.class)
- public RestTemplate restTemplateFallbackFromCode() {
- DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://polaris-circuitbreaker-callee-service");
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setUriTemplateHandler(uriBuilderFactory);
- return restTemplate;
- }
-
-}
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
deleted file mode 100644
index 9cd52b817..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-server:
- port: 48080
-spring:
- application:
- name: polaris-circuitbreaker-resttemplate-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- loadbalancer:
- enabled: true
- circuitbreaker:
- enabled: true
-
-logging:
- level:
- root: info
- com.tencent.cloud: debug
-
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-circuit-breaker
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
deleted file mode 100644
index 5e85be2d8..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- 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-starter-actuator
-
-
-
-
-
-
- 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
deleted file mode 100644
index 72f3c80d5..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAController.java
+++ /dev/null
@@ -1,59 +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.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
deleted file mode 100644
index 8104ae873..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/webclient/example/ServiceAWebClient.java
+++ /dev/null
@@ -1,45 +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.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
deleted file mode 100644
index 9c6f22fde..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-webclient-example/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-server:
- port: 48080
-spring:
- application:
- name: polaris-circuitbreaker-webclient-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- loadbalancer:
- enabled: true
- circuitbreaker:
- enabled: true
-
-logging:
- level:
- root: info
- com.tencent.cloud: debug
-
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-circuit-breaker
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml b/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml
deleted file mode 100644
index 8e53f8d77..000000000
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/pom.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-circuitbreaker-example
- Polaris Circuit Breaker Example
- pom
-
-
- polaris-circuitbreaker-feign-example
- polaris-circuitbreaker-gateway-example
- polaris-circuitbreaker-resttemplate-example
- polaris-circuitbreaker-webclient-example
- polaris-circuitbreaker-callee-service
- polaris-circuitbreaker-callee-service2
-
-
diff --git a/spring-cloud-tencent-examples/polaris-config-example/README-zh.md b/spring-cloud-tencent-examples/polaris-config-example/README-zh.md
deleted file mode 100644
index f131d319e..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/README-zh.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# Polaris Config Example 使用指南
-
-## 1. bootstrap.yml 配置
-
-修改 resources/bootstrap.yml ```spring.cloud.polaris.config.address``` 北极星服务端地址。
-> 注意是在 bootstrap.yml 里配置,而不是在 application.yml 里配置。因为配置中心相关的配置是在 bootstrap 阶段依赖的配置。
-
-```` yaml
-spring:
- application:
- name: polaris-config-example
- cloud:
- polaris:
- namespace: dev
- config:
- address: grpc://127.0.0.1:8093 # the address of polaris config server
- auto-refresh: true # auto refresh when config file changed
- groups:
- - name: ${spring.application.name} # group name
- files: [ "config/application.properties", "config/bootstrap.yml" ] # config/application.properties takes precedence over config/bootstrap.yml
-````
-
-## 2. 在北极星服务端创建配置文件
-
-### 2.1 创建 namespace (dev)
-### 2.2 创建配置文件分组(polaris-config-example)
-
-北极星的配置文件分组概念为一组配置文件的集合,推荐应用名=分组名,例如在我们的示例中,新建一个 polaris-config-example 的分组。
-把 polaris-config-example 应用的配置文件都放在 polaris-config-example 分组下,这样便于配置管理。
-
-### 2.3 创建两个配置文件 config/application.properties 、config/bootstrap.yml
-
-北极星配置中心的控制台,配置文件名可以通过 / 来按树状目录结构展示,通过树状结构可以清晰的管理配置文件。
-
-#### 2.3.1 config/application.properties 文件内容
-
- ```` properties
-timeout = 3000
-````
-
-#### 2.3.2 config/bootstrap.yml 文件内容
-
-````yaml
-teacher:
- name : 张三
- age: 38
-````
-
-页面样例如下图所示:
-
-![](polaris-config-ui.png)
-
-## 3. 运行 PolarisConfigExampleApplication
-
-## 4. 访问接口
-
-````
-curl "http://localhost:48084/timeout"
-
-curl "http://localhost:48084/person"
-````
-
-## 5. 动态推送能力
-
-### 5.1 管控台动态修改并发布 config/application.properties
-
- ```` properties
-timeout = 5000
-````
-
-### 5.2 再次访问接口
-````
-curl "http://localhost:48084/timeout"
-````
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-config-example/polaris-config-ui.png b/spring-cloud-tencent-examples/polaris-config-example/polaris-config-ui.png
deleted file mode 100644
index ebc5a0c06..000000000
Binary files a/spring-cloud-tencent-examples/polaris-config-example/polaris-config-ui.png and /dev/null differ
diff --git a/spring-cloud-tencent-examples/polaris-config-example/pom.xml b/spring-cloud-tencent-examples/polaris-config-example/pom.xml
deleted file mode 100644
index bb7ef026e..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-config-example
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-config
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java
deleted file mode 100644
index b4fe1a3e7..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/ConfigController.java
+++ /dev/null
@@ -1,52 +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.config.example;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.env.Environment;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * the endpoint for get config.
- *
- * @author lepdou 2022-03-10
- */
-@RestController
-public class ConfigController {
-
- @Value("${timeout:1000}")
- private int timeout;
-
- @Autowired
- private Person person;
-
- @Autowired
- private Environment environment;
-
- @GetMapping("/timeout")
- public int timeout() {
- environment.getProperty("timeout", "1000");
- return timeout;
- }
-
- @GetMapping("/person")
- public String person() {
- return person.toString();
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java
deleted file mode 100644
index 38bb2cae6..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/Person.java
+++ /dev/null
@@ -1,84 +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.config.example;
-
-import java.util.List;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * example property object.
- *
- * @author lepdou 2022-03-28
- */
-@Component
-@ConfigurationProperties(prefix = "teacher")
-public class Person {
-
- private String name;
-
- private int age;
-
- private boolean director;
-
- private List students;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public boolean isDirector() {
- return director;
- }
-
- public void setDirector(boolean director) {
- this.director = director;
- }
-
- public List getStudents() {
- return students;
- }
-
- public void setStudents(List students) {
- this.students = students;
- }
-
- @Override
- public String toString() {
- return "Person{" +
- "name='" + name + '\'' +
- ", age=" + age +
- ", director=" + director +
- ", students=" + students +
- '}';
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java
deleted file mode 100644
index 108b22038..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PersonConfigChangeListener.java
+++ /dev/null
@@ -1,66 +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.config.example;
-
-import java.util.Set;
-
-import com.tencent.cloud.polaris.config.annotation.PolarisConfigKVFileChangeListener;
-import com.tencent.cloud.polaris.config.listener.ConfigChangeEvent;
-
-import org.springframework.stereotype.Component;
-
-/**
- * Custom Config Listener Example .
- *
- * @author Palmer Xu 2022-06-06
- */
-@Component
-public final class PersonConfigChangeListener {
-
- /**
- * PolarisConfigKVFileChangeListener Example .
- * @param event instance of {@link ConfigChangeEvent}
- */
- @PolarisConfigKVFileChangeListener(interestedKeyPrefixes = "teacher")
- public void onChange(ConfigChangeEvent event) {
- Set changedKeys = event.changedKeys();
-
- for (String changedKey : changedKeys) {
- System.out.printf("%s = %s , ThreadId: %s\n", changedKey, event.getChange(changedKey), Thread.currentThread().getId());
- }
- }
-
- @PolarisConfigKVFileChangeListener(interestedKeyPrefixes = "teacher", async = false)
- public void syncListen(ConfigChangeEvent event) {
- Set changedKeys = event.changedKeys();
-
- for (String changedKey : changedKeys) {
- System.out.printf("%s = %s , ThreadId: %s\n", changedKey, event.getChange(changedKey), Thread.currentThread().getId());
- }
- }
-
- @PolarisConfigKVFileChangeListener(interestedKeyPrefixes = "teacher", async = false)
- public void syncListen2(ConfigChangeEvent event) {
- Set changedKeys = event.changedKeys();
-
- for (String changedKey : changedKeys) {
- System.out.printf("%s = %s , ThreadId: %s\n", changedKey, event.getChange(changedKey), Thread.currentThread().getId());
- }
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java b/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java
deleted file mode 100644
index 37544956b..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/src/main/java/com/tencent/cloud/polaris/config/example/PolarisConfigExampleApplication.java
+++ /dev/null
@@ -1,34 +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.config.example;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * example application starter.
- *
- * @author lepdou 2022-03-10
- */
-@SpringBootApplication
-public class PolarisConfigExampleApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(PolarisConfigExampleApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-config-example/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-config-example/src/main/resources/bootstrap.yml
deleted file mode 100644
index 94afb2b7e..000000000
--- a/spring-cloud-tencent-examples/polaris-config-example/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-server:
- port: 48084
-spring:
- application:
- name: polaris-config-example
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- config:
- auto-refresh: true # auto refresh when config file changed
- # data-source: local # config data source default is polaris.
- # local-file-root-path: # set root path for reading config file, when in local data source
- groups:
- - name: ${spring.application.name} # group name
- files: [ "config/application.properties", "config/bootstrap.yml" ] # config/application.properties takes precedence over config/bootstrap.yml
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-config
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/README-zh.md b/spring-cloud-tencent-examples/polaris-discovery-example/README-zh.md
deleted file mode 100644
index 851860f06..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/README-zh.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Spring Cloud Polaris Discovery example
-
-## 样例简介
-
-本样例将介绍如何在Spring Cloud项目中使用```spring-cloud-starter-tencent-polaris-discovery```以使用其各项功能。
-
-该样例分为两个微服务,即 ```discovery-caller-service``` 和 ```discovery-callee-service ```。
-其中 ```discovery-caller-service``` 调用 ```discovery-callee-service```
-
-## 使用说明
-
-### 修改配置
-
-修改 resource/bootstrap.yml 中北极星的服务端地址
-
-```yaml
-spring:
- cloud:
- polaris:
- address: grpc://${ip}:8091
-```
-
-### 启动样例
-
-#### 启动Polaris后端服务
-
-参考[Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)。
-
-#### 启动应用
-
-- IDEA启动
-
-分别启动
-
-1. ```spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service```下的```DiscoveryCallerService```
-2. ```spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service```下的```DiscoveryCalleeService```
-
-### 验证
-
-#### 调用 discovery-caller-service 暴露的接口
-
-执行以下命令发起Feign调用,其逻辑为```DiscoveryCalleeService```返回 value1+value2 的和
-
-```shell
-curl -L -X GET 'http://localhost:48080/discovery/service/caller/feign?value1=1&value2=2'
-```
-
-预期返回值
-
-```
-3
-```
-
-#### RestTemplate调用
-
-执行以下命令发起RestTemplate调用,其逻辑为```DiscoveryCalleeService```返回一段字符串
-
-```shell
-curl -L -X GET 'http://localhost:48080/discovery/service/caller/rest'
-```
-
-预期返回值
-
-```
-Discovery Service Callee
-```
-
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/README.md b/spring-cloud-tencent-examples/polaris-discovery-example/README.md
deleted file mode 100644
index c9280f6f4..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Spring Cloud Polaris Discovery example
-
-## Example Introduction
-
-This example shows how to use ```spring-cloud-starter-tencent-polaris-discovery`` in Spring Cloud project for its features.
-
-This example is divided to two microservice, discovery-caller-service and discovery-callee-service. In these two microservices, discovery-caller-service invokes discovery-callee-service.
-
-## Instruction
-
-### Configuration
-
-The configuration is as the following shows. ${ip} and ${port} are Polaris backend IP address and port number.
-
-```yaml
-spring:
- application:
- name: ${application.name}
- cloud:
- polaris:
- address: ${ip}:${port}
-```
-
-### Launching Example
-
-#### Launching Polaris Backend Service
-
-Reference to [Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)
-
-#### Launching Application
-
-- IDEA Launching
-
-Launching ```spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service```'s ```DiscoveryCallerService``` and ```spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service```'s ```DiscoveryCalleeService```
-
-- Maven Package Launching
-
-Execute under ```spring-cloud-tencent-examples/polaris-discovery-example```
-
-```sh
-mvn clean package
-```
-
-Then at ```discovery-caller-service``` and ```discovery-callee-service``` find the package that generates jar, and run it
-
-```
-java -jar ${app.jar}
-```
-
-Launch application, change ${app.jar} to jar's package name
-
-### Verify
-
-#### Feign Invoke
-
-Execute the following orders to invoke Feign, ```DiscoveryCalleeService``` goes bank to the sum of value1+value2
-
-```shell
-curl -L -X GET 'http://localhost:48080/discovery/service/caller/feign?value1=1&value2=2'
-```
-
-Expected return rate
-
-```
-3
-```
-
-#### RestTemplate Invoke
-
-Execute the following orders to invoke RestTemplate, ```DiscoveryCalleeService``` goes back to string characters
-
-```shell
-curl -L -X GET 'http://localhost:48080/discovery/service/caller/rest'
-```
-
-Expected return rate
-
-```
-Discovery Service Callee
-```
-
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml
deleted file mode 100644
index 312b45c1a..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/pom.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
- polaris-discovery-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- discovery-callee-service
- Polaris Discovery Callee Service
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-contract
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java
deleted file mode 100644
index fbfa22614..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java
+++ /dev/null
@@ -1,47 +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.discovery.service.callee;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.tencent.cloud.common.spi.InstanceMetadataProvider;
-
-import org.springframework.stereotype.Component;
-
-/**
- * custom metadata for instance.
- *
- * @author lepdou 2022-06-16
- */
-@Component
-public class CustomMetadata implements InstanceMetadataProvider {
-
- @Override
- public Map getMetadata() {
- Map metadata = new HashMap<>();
- metadata.put("k1", "v1");
- return metadata;
- }
-
- @Override
- public String getZone() {
- return "shanghai-zone-1";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java
deleted file mode 100644
index a15336393..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeController.java
+++ /dev/null
@@ -1,69 +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.discovery.service.callee;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Discovery callee controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/discovery/service/callee")
-public class DiscoveryCalleeController {
-
- private static final Logger LOG = LoggerFactory.getLogger(DiscoveryCalleeController.class);
-
- @Value("${server.port:0}")
- private int port;
-
- @Value("${spring.cloud.client.ip-address:127.0.0.1}")
- private String ip;
-
- /**
- * Get information of callee.
- *
- * @return information of callee
- */
- @GetMapping("/info")
- public String info() {
- LOG.info("Discovery Service Callee [{}:{}] is called.", ip, port);
- return String.format("Discovery Service Callee [%s:%s] is called.", ip, port);
- }
-
- /**
- * Get sum of two value.
- *
- * @param value1 value 1
- * @param value2 value 2
- * @return sum
- */
- @GetMapping("/sum")
- public int sum(@RequestParam int value1, @RequestParam int value2) {
- LOG.info("Discovery Service Callee [{}:{}] is called and sum is {}.", ip, port, value1 + value2);
- return value1 + value2;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java
deleted file mode 100644
index 9063ae984..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/DiscoveryCalleeService.java
+++ /dev/null
@@ -1,34 +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.discovery.service.callee;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Discovery callee application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class DiscoveryCalleeService {
-
- public static void main(String[] args) {
- SpringApplication.run(DiscoveryCalleeService.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index 1f3a5b9e5..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-server:
- port: ${random.int(7003,7005)}
-spring:
- application:
- name: DiscoveryCalleeService
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- discovery:
- enabled: true
- register: true
- contract:
- exposure: true
- stat:
- enabled: true
- port: 28082
- # pushgateway:
- # enabled: true
- # address: 127.0.0.1:9091
- tencent:
- metadata:
- content:
- region: shanghai
- rpc-enhancement:
- reporter:
- enabled: true
-# consul:
-# port: 8500
-# host: 127.0.0.1
-# enabled: true
-# discovery:
-# enabled: true
-# register: true
-# instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}
-# service-name: ${spring.application.name}
-# ip-address: localhost
-# prefer-ip-address: true
-# nacos:
-# enabled: true
-# password: nacos
-# username: nacos
-# discovery:
-# enabled: true
-# register-enabled: true
-# group: polaris
-# server-addr: 127.0.0.1:8848
-
-#eureka:
-# client:
-# serviceUrl:
-# defaultZone: http://127.0.0.1:7654/eureka/
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml
deleted file mode 100644
index f6a28f36e..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
- polaris-discovery-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- discovery-caller-service
- Polaris Discovery Caller Service
-
-
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-contract
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java
deleted file mode 100644
index 44d20df14..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeService.java
+++ /dev/null
@@ -1,40 +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.discovery.service.caller;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * Discovery callee feign client.
- *
- * @author Haotian Zhang
- */
-@FeignClient(value = "DiscoveryCalleeService", fallback = DiscoveryCalleeServiceFallback.class)
-public interface DiscoveryCalleeService {
-
- /**
- * Get sum of two value.
- * @param value1 value 1
- * @param value2 value 2
- * @return sum
- */
- @GetMapping("/discovery/service/callee/sum")
- int sum(@RequestParam("value1") int value1, @RequestParam("value2") int value2);
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java
deleted file mode 100644
index 166441cd6..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerController.java
+++ /dev/null
@@ -1,70 +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.discovery.service.caller;
-
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * Discovery caller controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/discovery/service/caller")
-public class DiscoveryCallerController {
-
- @Autowired
- private RestTemplate restTemplate;
-
- @Autowired
- private DiscoveryCalleeService discoveryCalleeService;
-
- /**
- * Get sum of two value.
- * @param value1 value 1
- * @param value2 value 2
- * @return sum
- */
- @RequestMapping("/feign")
- public int feign(@RequestParam int value1, @RequestParam int value2) {
- return discoveryCalleeService.sum(value1, value2);
- }
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest() {
- return restTemplate.getForObject("http://DiscoveryCalleeService/discovery/service/callee/info", String.class);
- }
-
- /**
- * health check.
- * @return health check info
- */
- @GetMapping("/healthCheck")
- public String healthCheck() {
- return "pk ok";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java
deleted file mode 100644
index 5c447313c..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCallerService.java
+++ /dev/null
@@ -1,47 +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.discovery.service.caller;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-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;
-
-/**
- * Discovery caller application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-@EnableDiscoveryClient
-@EnableFeignClients
-public class DiscoveryCallerService {
-
- public static void main(String[] args) {
- SpringApplication.run(DiscoveryCallerService.class, args);
- }
-
- @Bean
- @LoadBalanced
- public RestTemplate restTemplate() {
- return new RestTemplate();
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index c338f6877..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-server:
- session-timeout: 1800
- port: 48080
-spring:
- application:
- name: DiscoveryCallerService
- cloud:
- tencent:
- metadata:
- content:
- region: shanghai
- rpc-enhancement:
- reporter:
- enabled: false
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- discovery:
- enabled: true
- register: true
- heartbeat:
- enabled: true
- health-check-url: /discovery/service/caller/healthCheck
- contract:
- exposure: true
- report:
- enabled: true
- stat:
- enabled: true
- port: 28081
-# pushgateway:
-# enabled: true
-# address: 127.0.0.1:9091
-# consul:
-# port: 8500
-# host: 127.0.0.1
-# enabled: true
-# discovery:
-# enabled: true
-# register: true
-# health-check-path: /actuator/health
-# health-check-interval: 10s
-# instance-id: ${spring.application.name}:${server.port}
-# service-name: ${spring.application.name}
-# ip-address: localhost
-# prefer-ip-address: true
-# nacos:
-# enabled: true
-# password: nacos
-# username: nacos
-# context-path: /nacos
-# discovery:
-# enabled: true
-# register-enabled: true
-# group: polaris
-# server-addr: 127.0.0.1:8848
-# cluster-name: polaris
-#eureka:
-# client:
-# serviceUrl:
-# defaultZone: http://127.0.0.1:7654/eureka/
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-discovery
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/pom.xml b/spring-cloud-tencent-examples/polaris-discovery-example/pom.xml
deleted file mode 100644
index 2ce2a3e3d..000000000
--- a/spring-cloud-tencent-examples/polaris-discovery-example/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-discovery-example
- pom
- Spring Cloud Starter Tencent Polaris Discovery Example
-
-
- discovery-callee-service
- discovery-caller-service
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/README-zh.md b/spring-cloud-tencent-examples/polaris-gateway-example/README-zh.md
deleted file mode 100644
index 57148902e..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/README-zh.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# Spring Cloud Polaris Gateway example
-
-## 样例简介
-
-本样例将介绍如何在Spring Cloud项目中使用```spring-cloud-tencent-polaris-gateway```以使用其各项功能。
-
-本样例包括```gateway-zuul-service```、```gateway-scg-service```和```gateway-callee-service```。```gateway-zuul-service```和```gateway-scg-service```调用```gateway-callee-service```。
-
-## 使用说明
-
-### 修改配置
-
-配置如下所示。其中,${ip}和${port}为Polaris后端服务的IP地址与端口号。
-
-```yaml
-spring:
- application:
- name: ${application.name}
- cloud:
- polaris:
- address: ${ip}:${port}
-```
-
-### 启动样例
-
-#### 启动Polaris后端服务
-
-参考[Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)。
-
-#### 启动应用
-
-- IDEA启动
-
-分别启动```spring-cloud-tencent-examples/polaris-gateway-example/gateway-zuul-service```的```GatewayZuulService```、```spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service```的```GatewayScgService```和```spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service```的```GatewayCalleeService```
-
-- Maven打包启动
-
-在```spring-cloud-tencent-examples/polaris-gateway-example```下执行
-
-```sh
-mvn clean package
-```
-
-然后在```gateway-zuul-service```、```gateway-scg-service```和```gateway-callee-service```下找到生成的jar包,运行
-
-```
-java -jar ${app.jar}
-```
-
-启动应用,其中${app.jar}替换为对应的jar包名。
-
-### 验证
-
-#### Zuul调用
-
-```shell
-curl -L -X GET 'http://localhost:48082/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'
-```
-
-预期返回值
-
-```
-{"a":"1","b":2}
-```
-
-#### Spring-Cloud-Gateway调用
-
-```shell
-curl -L -X GET 'http://localhost:48083/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'
-```
-
-预期返回值
-
-```
-{"a":"1","b":2}
-```
-
-#### 网关限流
-
-参考[Polaris RateLimit Example](../polaris-ratelimit-example/README-zh.md)
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/README.md b/spring-cloud-tencent-examples/polaris-gateway-example/README.md
deleted file mode 100644
index b1bb35671..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Spring Cloud Polaris Gateway example
-
-## Example Introduction
-
-This example shows how to use ```spring-cloud-tencent-polaris-gateway``` in Spring Cloud project for its features.
-
-This example contains ```gateway-zuul-service```, ```gateway-scg-service``` and ```gateway-callee-service```. ```gateway-zuul-service``` and ```gateway-scg-service``` invoke ```gateway-callee-service```.
-
-## Instruction
-
-### Configuration
-
-The configuration is as the following shows. ${ip} and ${port} are Polaris backend IP address and port number.
-
-```yaml
-spring:
- application:
- name: ${application.name}
- cloud:
- polaris:
- address: ${ip}:${port}
-```
-
-### Launching Example
-
-#### Launching Polaris Backend Service
-
-Reference to [Polaris Getting Started](https://github.com/PolarisMesh/polaris#getting-started)
-
-#### Launching Application
-
-- IDEA Launching
-
-Launching ```spring-cloud-tencent-examples/polaris-gateway-example/gateway-zuul-service```'s ```GatewayZuulService```, ```spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service```'s ```GatewayScgService``` and ```spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service```'s ```GatewayCalleeService```
-
-- Maven Package Launching
-
-Execute under ```spring-cloud-tencent-examples/polaris-gateway-example```
-
-```sh
-mvn clean package
-```
-
-Then find the jars under ```gateway-zuul-service```, ```gateway-scg-service``` and ```gateway-callee-service```, and run it:
-
-```
-java -jar ${app.jar}
-```
-
-Launch application, change ${app.jar} to jar's package name.
-
-### Verify
-
-#### Zuul Invoke
-
-```shell
-curl -L -X GET 'http://localhost:48082/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'
-```
-
-Expected return rate
-
-```
-{"a":"1","b":2}
-```
-
-#### Spring-Cloud-Gateway Invoke
-
-```shell
-curl -L -X GET 'http://localhost:48083/GatewayCalleeService/gateway/example/callee/echo' -H 'SCT-CUSTOM-METADATA: {"b": 2}'
-```
-
-Expected return rate
-
-```
-{"a":"1","b":2}
-```
-
-#### Gateway Rate Limit
-
-See [Polaris RateLimit Example](../polaris-ratelimit-example/README.md)
-
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/pom.xml
deleted file mode 100644
index cc37a455b..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- polaris-gateway-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- gateway-callee-service
- Spring Cloud Starter Tencent Polaris Gateway Callee Example
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-metadata-transfer
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java
deleted file mode 100644
index 57d205e5e..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication.java
+++ /dev/null
@@ -1,34 +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.gateway.example.callee;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Gateway callee application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class GatewayCalleeApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(GatewayCalleeApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java
deleted file mode 100644
index 7736ed640..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java
+++ /dev/null
@@ -1,72 +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.gateway.example.callee;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-import com.tencent.cloud.common.constant.MetadataConstant;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import static com.tencent.cloud.common.constant.ContextConstant.UTF_8;
-
-/**
- * Gateway callee controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/gateway/example/callee")
-public class GatewayCalleeController {
-
- private static Logger LOG = LoggerFactory.getLogger(GatewayCalleeController.class);
-
- @Value("${server.port:0}")
- private int port;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @RequestMapping("/info")
- public String info() {
- LOG.info("Gateway Example Callee [{}] is called.", port);
- return String.format("Gateway Example Callee [%s] is called.", port);
- }
-
- /**
- * Get metadata in HTTP header.
- *
- * @param metadataStr metadata string
- * @return metadata in HTTP header
- * @throws UnsupportedEncodingException encoding exception
- */
- @RequestMapping("/echo")
- public String echoHeader(@RequestHeader(MetadataConstant.HeaderName.CUSTOM_METADATA) String metadataStr)
- throws UnsupportedEncodingException {
- LOG.info(URLDecoder.decode(metadataStr, UTF_8));
- metadataStr = URLDecoder.decode(metadataStr, UTF_8);
- return metadataStr;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index 9bf39bb82..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-server:
- session-timeout: 1800
- port: 48081
-spring:
- application:
- name: GatewayCalleeService
- cloud:
- tencent:
- metadata:
- content:
- env: blue
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/pom.xml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/pom.xml
deleted file mode 100644
index 1f0a2d1b9..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- polaris-gateway-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- gateway-callee-service2
- Spring Cloud Starter Tencent Polaris Gateway Callee Example
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-metadata-transfer
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java
deleted file mode 100644
index f6a942abd..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeApplication2.java
+++ /dev/null
@@ -1,34 +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.gateway.example.callee;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Gateway callee application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class GatewayCalleeApplication2 {
-
- public static void main(String[] args) {
- SpringApplication.run(GatewayCalleeApplication2.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java
deleted file mode 100644
index 7736ed640..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/java/com/tencent/cloud/polaris/gateway/example/callee/GatewayCalleeController.java
+++ /dev/null
@@ -1,72 +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.gateway.example.callee;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-import com.tencent.cloud.common.constant.MetadataConstant;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import static com.tencent.cloud.common.constant.ContextConstant.UTF_8;
-
-/**
- * Gateway callee controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/gateway/example/callee")
-public class GatewayCalleeController {
-
- private static Logger LOG = LoggerFactory.getLogger(GatewayCalleeController.class);
-
- @Value("${server.port:0}")
- private int port;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @RequestMapping("/info")
- public String info() {
- LOG.info("Gateway Example Callee [{}] is called.", port);
- return String.format("Gateway Example Callee [%s] is called.", port);
- }
-
- /**
- * Get metadata in HTTP header.
- *
- * @param metadataStr metadata string
- * @return metadata in HTTP header
- * @throws UnsupportedEncodingException encoding exception
- */
- @RequestMapping("/echo")
- public String echoHeader(@RequestHeader(MetadataConstant.HeaderName.CUSTOM_METADATA) String metadataStr)
- throws UnsupportedEncodingException {
- LOG.info(URLDecoder.decode(metadataStr, UTF_8));
- metadataStr = URLDecoder.decode(metadataStr, UTF_8);
- return metadataStr;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/resources/bootstrap.yml
deleted file mode 100644
index 83f98b12f..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-callee-service2/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-server:
- session-timeout: 1800
- port: 48082
-spring:
- application:
- name: GatewayCalleeService
- cloud:
- tencent:
- metadata:
- content:
- env: green
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/pom.xml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/pom.xml
deleted file mode 100644
index 1d9887427..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
- polaris-gateway-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- gateway-scg-service
- Spring Cloud Starter Tencent Polaris Gateway SCG Example
-
-
-
- spring-cloud-starter-tencent-polaris-discovery
- com.tencent.cloud
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-ratelimit
-
-
-
- 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
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java
deleted file mode 100644
index 7bf729994..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/java/com/tencent/cloud/polaris/gateway/example/scg/GatewayScgApplication.java
+++ /dev/null
@@ -1,34 +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.gateway.example.scg;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * SCG application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class GatewayScgApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(GatewayScgApplication.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index 7f1aa5671..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/gateway-scg-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-server:
- session-timeout: 1800
- port: 48083
-spring:
- application:
- name: GatewayScgService
- cloud:
- tencent:
- plugin:
- scg:
- staining:
- enabled: true
- rule-staining:
- enabled: true
- router:
- feature-env:
- enabled: true
- metadata:
- content:
- a: 1
- transitive:
- - a
- polaris:
- address: grpc://119.91.66.223: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: Retry
- args:
- retries: 3
- exceptions:
- '[0]': '''java.net.ConnectException'''
- '[1]': '''java.io.IOException'''
- statuses:
- '[0]': '''BAD_GATEWAY'''
- '[1]': '''SERVICE_UNAVAILABLE'''
- series:
- '[0]': '''CLIENT_ERROR'''
- methods:
- '[0]': '''GET'''
- '[1]': '''POST'''
- '[2]': '''PUT'''
- '[3]': '''DELETE'''
- backoff:
- firstBackoff: '''100ms'''
- maxBackoff: '''500ms'''
- factor: 2
- basedOnPreviousValue: false
- routes:
- - id: GatewayCalleeService
- uri: lb://GatewayCalleeService
- predicates:
- - Path=/GatewayCalleeService/**
- filters:
- - StripPrefix=1
diff --git a/spring-cloud-tencent-examples/polaris-gateway-example/pom.xml b/spring-cloud-tencent-examples/polaris-gateway-example/pom.xml
deleted file mode 100644
index e67b8a8dd..000000000
--- a/spring-cloud-tencent-examples/polaris-gateway-example/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-gateway-example
- pom
- Spring Cloud Starter Tencent Polaris Gateway Example
-
-
- gateway-scg-service
- gateway-callee-service
- gateway-callee-service2
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/README-zh.md b/spring-cloud-tencent-examples/polaris-ratelimit-example/README-zh.md
deleted file mode 100644
index b9c30ddfe..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/README-zh.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Spring Cloud Polaris RateLimit Example
-
-## 项目说明
-
-本项目演示如何使用 Polaris ratelimit starter 完成 Spring Cloud 应用的限流管理。
-
-## 示例
-
-### 如何接入
-
-在启动示例进行演示之前,我们先了解一下如何接入 Polaris 限流组件。
-
-> **注意:本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。**
-
-1. 首先,修改 `pom.xml` 文件,引入 Polaris ratelimit starter。
- ```xml
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-ratelimit
-
- ```
-
-2. 启动应用
-
- 北极星提供的example都支持在IDE中直接运行,或者编译打包后通过命令行方式进行运行。
- - 在本地启动Polaris服务端。
- - 在北极星服务端,可以通过控制台,在命名空间Production下,添加服务RateLimitCalleeService。
- - 启动服务被调方:
- 1. IDE直接启动:找到主类 `RateLimitCalleeService`,执行 main 方法启动应用。
- 2. 打包编译后启动:首先执行 `mvn clean package` 将工程编译打包,然后执行 `java -jar ratelimit-callee-sevice-${verion}.jar`启动应用。
- - 启动后,可以在北极星控制台上看到注册上来的服务实例信息。
-
-3. 调用服务
-
- 通过浏览器访问http://127.0.0.1:48081/business/invoke,可以看到以下输出信息:
- ````
- hello world for ratelimit service 1
- hello world for ratelimit service 2
- hello world for ratelimit service 3
- ...
- ````
-
-4. 配置限流规则并验证
- 北极星提供了三个方式进行限流规则的配置(控制台、HTTP接口以及本地文件)。
-
- 本示例使用的方式为通过HTTP接口进行配置。通过以下命令来配置:
- ````
- curl -X POST -H "Content-Type:application/json" 127.0.0.1:8090/naming/v1/ratelimits -d @rule.json
- ````
-
-5. 验证限流效果
- 继续访问http://127.0.0.1:48081/business/invoke,可以看到,10次调用后,就开始被限流:
- ````
- hello world for ratelimit service 1
- hello world for ratelimit service 2
- ...
- hello world for ratelimit service 10
- request has been limited, service is RateLimitCalleeService, path is /business/invoke, 11
- ````
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/README.md b/spring-cloud-tencent-examples/polaris-ratelimit-example/README.md
deleted file mode 100644
index 5b85e6077..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Spring Cloud Polaris RateLimit Example
-
-## Project Explanation
-
-This project shows how to use ratelimit feature of Polaris to complete Spring Cloud application's rate limit
-
-## Example
-
-### How to access
-
-Before showcasing the project, let's get to know how to access Polaris rate limit component
-
-> ** note: this chapter is to help you understand different ways to access, the codes in the example has been executed, you don't need to re-edit.**
-
-1, first, change document `pom.xml`, introduce Polaris ratelimit starter
-
- ```xml
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-ratelimit
-
- ```
-
-2. Launch Application
-
-Examples provided by Polaris all support to run at IDE, or compile and run with orders
-
-- Launch Polaris locally
-
-- at Polaris end, through control panel, under namespace Product, add RateLimitCalleeService
-
-- Launch callee server:
-
- 1. Launch IDE directly: First find `RateLimitCalleeService`, execute main then launch application
- 2. compile package then launch: first execute `mvn clean package` compile the package, then execute `java -jar ratelimit-callee-sevice-${verion}.jar` execute the application
-
- - After launching, one can watch server instance from Polaris control panel
-
- 3. Invoke Service
-
- After visiting http://127.0.0.1:48081/business/invoke, one can see the following information:
-
- ````
- hello world for ratelimit service 1
- hello world for ratelimit service 2
- hello world for ratelimit service 3
- ...
- ````
-
-4. Configuration rate limit and verification
- Polaris provide three wats to conduct rate limit configuration (control panel, HTTP port and local files)
-
-this example is HTTP configuration. One can figure with the following steps:
-
- ````
- curl -X POST -H "Content-Type:application/json" 127.0.0.1:8090/naming/v1/ratelimits -d @rule.json
- ````
-
-5. Verify rate limit result
- continue visit http://127.0.0.1:48081/business/invoke, one can see, after 10 invokes, rate limit will start:
-
- ````
- hello world for ratelimit service 1
- hello world for ratelimit service 2
-
- ````
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/pom.xml b/spring-cloud-tencent-examples/polaris-ratelimit-example/pom.xml
deleted file mode 100644
index c23178094..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/pom.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-ratelimit-example
- pom
- Spring Cloud Starter Tencent Polaris RateLimit Example
-
-
- ratelimit-callee-service
-
-
\ No newline at end of file
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/pom.xml b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/pom.xml
deleted file mode 100644
index 613cf24f7..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- polaris-ratelimit-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- ratelimit-callee-service
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-ratelimit
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/BusinessController.java b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/BusinessController.java
deleted file mode 100644
index 902d6681f..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/BusinessController.java
+++ /dev/null
@@ -1,177 +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.ratelimit.example.service.callee;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import reactor.core.publisher.Mono;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-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.HttpClientErrorException.TooManyRequests;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.reactive.function.client.WebClient;
-import org.springframework.web.reactive.function.client.WebClientResponseException;
-
-/**
- * Rate limit controller.
- *
- * @author Haotian Zhang
- */
-@RestController
-@RequestMapping("/business")
-public class BusinessController {
-
- private static final Logger LOG = LoggerFactory.getLogger(BusinessController.class);
-
- private final AtomicInteger index = new AtomicInteger(0);
- private final AtomicLong lastTimestamp = new AtomicLong(0);
- @Autowired
- private RestTemplate restTemplate;
- @Autowired
- private WebClient.Builder webClientBuilder;
- @Value("${spring.application.name}")
- private String appName;
-
- /**
- * Get information.
- *
- * @return information
- */
- @GetMapping("/info")
- public String info() {
- return "hello world for ratelimit service " + index.incrementAndGet();
- }
-
- @GetMapping("/info/webclient")
- public Mono infoWebClient() {
- return Mono.just("hello world for ratelimit service " + index.incrementAndGet());
- }
-
- @GetMapping("/invoke/webclient")
- public String invokeInfoWebClient() throws InterruptedException, ExecutionException {
- StringBuffer builder = new StringBuffer();
- WebClient webClient = webClientBuilder.baseUrl("http://" + appName).build();
- List> monoList = new ArrayList<>();
- for (int i = 0; i < 30; i++) {
- Mono response = webClient.get()
- .uri(uriBuilder -> uriBuilder
- .path("/business/info/webclient")
- .queryParam("yyy", "yyy")
- .build()
- )
- .header("xxx", "xxx")
- .retrieve()
- .bodyToMono(String.class)
- .doOnSuccess(s -> builder.append(s + "\n"))
- .doOnError(e -> {
- if (e instanceof WebClientResponseException) {
- if (((WebClientResponseException) e).getRawStatusCode() == 429) {
- builder.append("TooManyRequests ").append(index.incrementAndGet() + "\n");
- }
- }
- })
- .onErrorReturn("");
- monoList.add(response);
- }
- for (Mono mono : monoList) {
- mono.toFuture().get();
- }
- index.set(0);
- return builder.toString();
- }
-
- /**
- * Get information 30 times per 1 second.
- *
- * @return result of 30 calls.
- * @throws InterruptedException exception
- */
- @GetMapping("/invoke")
- public String invokeInfo() throws InterruptedException {
- StringBuffer builder = new StringBuffer();
- CountDownLatch count = new CountDownLatch(30);
- for (int i = 0; i < 30; i++) {
- new Thread(() -> {
- try {
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.add("xxx", "xxx");
- ResponseEntity entity = restTemplate.exchange(
- "http://" + appName + "/business/info?yyy={yyy}",
- HttpMethod.GET,
- new HttpEntity<>(httpHeaders),
- String.class,
- "yyy"
- );
- builder.append(entity.getBody() + "\n");
- }
- catch (RestClientException e) {
- if (e instanceof TooManyRequests) {
- builder.append("TooManyRequests ").append(index.incrementAndGet() + "\n");
- }
- else {
- throw e;
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- count.countDown();
- }
- }).start();
- }
- count.await();
- index.set(0);
- return builder.toString();
- }
-
- /**
- * Get information with unirate.
- *
- * @return information
- */
- @GetMapping("/unirate")
- public String unirate() {
- long currentTimestamp = System.currentTimeMillis();
- long lastTime = lastTimestamp.get();
- if (lastTime != 0) {
- LOG.info("Current timestamp:" + currentTimestamp + ", diff from last timestamp:" + (currentTimestamp - lastTime));
- }
- else {
- LOG.info("Current timestamp:" + currentTimestamp);
- }
- lastTimestamp.set(currentTimestamp);
- return "hello world for ratelimit service with diff from last request:" + (currentTimestamp - lastTime) + "ms.";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java
deleted file mode 100644
index c8a49d2a7..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/RateLimitCalleeService.java
+++ /dev/null
@@ -1,51 +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.ratelimit.example.service.callee;
-
-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.client.RestTemplate;
-import org.springframework.web.reactive.function.client.WebClient;
-
-/**
- * Rate limit application.
- *
- * @author Haotian Zhang
- */
-@SpringBootApplication
-public class RateLimitCalleeService {
-
- public static void main(String[] args) {
- SpringApplication.run(RateLimitCalleeService.class, args);
- }
-
- @Bean
- @LoadBalanced
- public RestTemplate restTemplate() {
- return new RestTemplate();
- }
-
-
- @LoadBalanced
- @Bean
- WebClient.Builder webClientBuilder() {
- return WebClient.builder();
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index d2e813284..000000000
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-server:
- port: 48081
-spring:
- application:
- name: RateLimitCalleeService
- cloud:
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- ratelimit:
- enabled: true
- rejectRequestTipsFilePath: reject-tips.html
- maxQueuingTime: 500
- stat:
- enabled: true
- port: 28083
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-ratelimit
-logging:
- level:
- com.tencent.cloud.polaris: debug
diff --git a/spring-cloud-tencent-examples/polaris-router-example/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/pom.xml
deleted file mode 100644
index 5ae91d8bf..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/pom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- spring-cloud-tencent-examples
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- polaris-router-example
- pom
-
-
- router-callee-service1
- router-callee-service2
- router-caller-service
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml
deleted file mode 100644
index ee07d5401..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
- polaris-router-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- router-callee-service1
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- 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
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java
deleted file mode 100644
index 9c36234c4..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication1.java
+++ /dev/null
@@ -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.router.example;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Router callee application.
- *
- * @author lepdou 2022-04-06
- */
-@SpringBootApplication
-public class RouterCalleeApplication1 {
-
- public static void main(String[] args) {
- SpringApplication.run(RouterCalleeApplication1.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java
deleted file mode 100644
index ead2c1fe1..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java
+++ /dev/null
@@ -1,53 +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.router.example;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Discovery callee controller.
- *
- * @author lepdou 2022-04-06
- */
-@RestController
-@RequestMapping("/router/service/callee")
-public class RouterCalleeController {
-
- private static Logger LOG = LoggerFactory.getLogger(RouterCalleeController.class);
-
- @Value("${server.port:0}")
- private int port;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @PostMapping("/info")
- public String info(String name, @RequestBody User user) {
- LOG.info("Discovery Service Callee [{}] is called.", port);
- return String.format("Discovery Service Callee [%s] is called. user = %s", port, user);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/User.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/User.java
deleted file mode 100644
index ff83552db..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/java/com/tencent/cloud/polaris/router/example/User.java
+++ /dev/null
@@ -1,53 +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.router.example;
-
-/**
- * demo object.
- * @author lepdou 2022-05-12
- */
-public class User {
-
- private String name;
- private int age;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- @Override
- public String toString() {
- return "User{" +
- "name='" + name + '\'' +
- ", age=" + age +
- '}';
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/resources/bootstrap.yml
deleted file mode 100644
index e3248f4da..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service1/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-server:
- port: 48081
-spring:
- application:
- name: RouterCalleeService
- cloud:
- tencent:
- metadata:
- content:
- label1: value1
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml
deleted file mode 100644
index 8ee075153..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
- polaris-router-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- router-callee-service2
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- 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
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java
deleted file mode 100644
index 076a002f0..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeApplication2.java
+++ /dev/null
@@ -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.router.example;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-/**
- * Router callee application.
- *
- * @author lepdou 2022-04-06
- */
-@SpringBootApplication
-public class RouterCalleeApplication2 {
-
- public static void main(String[] args) {
- SpringApplication.run(RouterCalleeApplication2.class, args);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java
deleted file mode 100644
index 075887766..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeController.java
+++ /dev/null
@@ -1,54 +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.router.example;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Discovery callee controller.
- *
- * @author lepdou 2022-04-06
- */
-@RestController
-@RequestMapping("/router/service/callee")
-public class RouterCalleeController {
-
- private static Logger LOG = LoggerFactory.getLogger(RouterCalleeController.class);
-
- @Value("${server.port:0}")
- private int port;
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @PostMapping("/info")
- public String info(@RequestParam("name") String name, @RequestBody User user) {
- LOG.info("Discovery Service Callee [{}] is called.", port);
- return String.format("Discovery Service Callee [%s] is called. user = %s", port, user);
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/User.java b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/User.java
deleted file mode 100644
index ff83552db..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/java/com/tencent/cloud/polaris/router/example/User.java
+++ /dev/null
@@ -1,53 +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.router.example;
-
-/**
- * demo object.
- * @author lepdou 2022-05-12
- */
-public class User {
-
- private String name;
- private int age;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- @Override
- public String toString() {
- return "User{" +
- "name='" + name + '\'' +
- ", age=" + age +
- '}';
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/resources/bootstrap.yml
deleted file mode 100644
index ff4805761..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-callee-service2/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-server:
- port: 48082
-spring:
- application:
- name: RouterCalleeService
- cloud:
- tencent:
- metadata:
- content:
- label1: value2
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml
deleted file mode 100644
index 2c4a25100..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
- polaris-router-example
- com.tencent.cloud
- ${revision}
- ../pom.xml
-
- 4.0.0
-
- router-caller-service
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-discovery
-
-
-
- com.tencent.cloud
- spring-cloud-starter-tencent-polaris-router
-
-
-
- org.springframework.retry
- spring-retry
- 1.3.1
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
-
-
-
- com.google.code.gson
- gson
- 2.9.0
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.0
-
-
- attach-sources
-
- jar
-
-
-
-
-
-
-
-
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java
deleted file mode 100644
index c0a84bf5f..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomSpringWebRouterLabelResolver.java
+++ /dev/null
@@ -1,51 +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.router.example;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.gson.Gson;
-import com.tencent.cloud.polaris.router.spi.SpringWebRouterLabelResolver;
-
-import org.springframework.http.HttpRequest;
-import org.springframework.stereotype.Component;
-
-/**
- * Custom router label resolver for spring web request.
- * @author lepdou 2022-07-20
- */
-@Component
-public class CustomSpringWebRouterLabelResolver implements SpringWebRouterLabelResolver {
- private final Gson gson = new Gson();
-
- @Override
- public int getOrder() {
- return 0;
- }
-
- @Override
- public Map resolve(HttpRequest request, byte[] body, Set expressionLabelKeys) {
- Map labels = new HashMap<>();
- User user = gson.fromJson(new String(body), User.class);
-
- labels.put("user", user.getName());
- return labels;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java
deleted file mode 100644
index d8f7df0ff..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCalleeService.java
+++ /dev/null
@@ -1,36 +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.router.example;
-
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * Router callee feign client.
- *
- * @author lepdou 2022-04-06
- */
-@FeignClient("RouterCalleeService")
-public interface RouterCalleeService {
-
- @PostMapping("/router/service/callee/info")
- String info(@RequestParam("name") String name, @RequestBody User user);
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java
deleted file mode 100644
index a3b05e6fd..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerApplication.java
+++ /dev/null
@@ -1,48 +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.router.example;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-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;
-
-/**
- * Router caller application.
- *
- * @author lepdou 2022-04-06
- */
-@SpringBootApplication
-@EnableDiscoveryClient
-@EnableFeignClients
-public class RouterCallerApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(RouterCallerApplication.class, args);
- }
-
- @Bean
- @LoadBalanced
- public RestTemplate restTemplate() {
- return new RestTemplate();
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java
deleted file mode 100644
index f296393a0..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/RouterCallerController.java
+++ /dev/null
@@ -1,76 +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.router.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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * Discovery caller controller.
- *
- * @author lepdou 2022-04-06
- */
-@RestController
-@RequestMapping("/router/service/caller")
-public class RouterCallerController {
-
- @Autowired
- private RestTemplate restTemplate;
-
- @Autowired
- private RouterCalleeService routerCalleeService;
-
- /**
- * Get info of two value.
- * @return info
- */
- @GetMapping("/feign")
- public String feign(@RequestParam String name) {
- User user = new User();
- user.setName(name);
- user.setAge(18);
- return routerCalleeService.info(name, user);
- }
-
- /**
- * Get information of callee.
- * @return information of callee
- */
- @GetMapping("/rest")
- public String rest(@RequestParam String name) {
- User user = new User();
- user.setName(name);
- user.setAge(18);
- return restTemplate.postForObject(
- "http://RouterCalleeService/router/service/callee/info?name={name}", user, String.class, name);
- }
-
- /**
- * health check.
- * @return health check info
- */
- @GetMapping("/healthCheck")
- public String healthCheck() {
- return "pk ok";
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/User.java b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/User.java
deleted file mode 100644
index f68c6fff4..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/User.java
+++ /dev/null
@@ -1,45 +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.router.example;
-
-/**
- * demo object.
- * @author lepdou 2022-05-12
- */
-public class User {
-
- private String name;
- private int age;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-}
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/resources/bootstrap.yml
deleted file mode 100644
index 8a2ef8e34..000000000
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-server:
- port: 48083
-spring:
- application:
- name: RouterCallerService
- cloud:
- tencent:
- metadata:
- content:
- k1: v1
- rpc-enhancement:
- reporter:
- enabled: true
- polaris:
- address: grpc://119.91.66.223:8091
- namespace: default
- enabled: true
- loadbalancer:
- enabled: true
- stat:
- enabled: true
- port: 28081
-management:
- endpoints:
- web:
- exposure:
- include:
- - polaris-router
diff --git a/spring-cloud-tencent-examples/pom.xml b/spring-cloud-tencent-examples/pom.xml
index c4ab03a30..c7e0c5a94 100644
--- a/spring-cloud-tencent-examples/pom.xml
+++ b/spring-cloud-tencent-examples/pom.xml
@@ -17,12 +17,6 @@
multiple-discovery-example
- polaris-discovery-example
- polaris-ratelimit-example
- polaris-circuitbreaker-example
- polaris-gateway-example
- polaris-config-example
- polaris-router-example
metadata-transfer-example
polaris-router-grayrelease-example
polaris-router-featureenv-example
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
index 24e580e18..ce6588118 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/pom.xml
@@ -23,6 +23,11 @@
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
index eecf3291f..96cdacea2 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
@@ -17,16 +17,24 @@
package com.tencent.cloud.quickstart.callee;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import com.tencent.cloud.common.constant.MetadataConstant;
+import com.tencent.cloud.quickstart.callee.config.DataSourceProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import static com.tencent.cloud.common.constant.ContextConstant.UTF_8;
+
/**
* Quickstart callee controller.
*
@@ -41,7 +49,10 @@ public class QuickstartCalleeController {
@Value("${server.port:0}")
private int port;
- @Value("${appName:Callee}")
+ @Value("${spring.cloud.client.ip-address:127.0.0.1}")
+ private String ip;
+
+ @Value("${appName:${spring.application.name}}")
private String appName;
@Autowired
@@ -55,7 +66,7 @@ public class QuickstartCalleeController {
*/
@GetMapping("/sum")
public int sum(@RequestParam int value1, @RequestParam int value2) {
- LOG.info("Quickstart Callee Service is called and sum is {}.", value1 + value2);
+ LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2);
return value1 + value2;
}
@@ -65,8 +76,23 @@ public int sum(@RequestParam int value1, @RequestParam int value2) {
*/
@GetMapping("/info")
public String info() {
- LOG.info("Quickstart [{}] Service [{}] is called. datasource = {}", appName, port, dataSourceProperties);
- return String.format("Quickstart [%s] Service [%s] is called. datasource = [%s]", appName, port, dataSourceProperties);
+ LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties);
+ return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties);
+ }
+
+ /**
+ * Get metadata in HTTP header.
+ *
+ * @param metadataStr metadata string
+ * @return metadata in HTTP header
+ * @throws UnsupportedEncodingException encoding exception
+ */
+ @RequestMapping("/echo")
+ public String echoHeader(@RequestHeader(MetadataConstant.HeaderName.CUSTOM_METADATA) String metadataStr)
+ throws UnsupportedEncodingException {
+ LOG.info(URLDecoder.decode(metadataStr, UTF_8));
+ metadataStr = URLDecoder.decode(metadataStr, UTF_8);
+ return metadataStr;
}
/**
@@ -76,7 +102,7 @@ public String info() {
*/
@GetMapping("/circuitBreak")
public String circuitBreak() {
- LOG.info("Quickstart Callee Service is called right.");
- return "Quickstart Callee Service is called right.";
+ LOG.info("Quickstart Callee Service [{}:{}] is called right.", ip, port);
+ return String.format("Quickstart Callee Service [%s:%s] is called right.", ip, port);
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
similarity index 84%
rename from spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
index 0bcfb554a..bd2b1295b 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
@@ -15,12 +15,14 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.quickstart.callee;
+package com.tencent.cloud.quickstart.callee.config;
import java.util.Set;
import com.tencent.cloud.polaris.config.annotation.PolarisConfigKVFileChangeListener;
import com.tencent.cloud.polaris.config.listener.ConfigChangeEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -32,6 +34,8 @@
@Component
public final class CustomConfigChangeListener {
+ private static final Logger LOG = LoggerFactory.getLogger(CustomConfigChangeListener.class);
+
/**
* PolarisConfigKVFileChangeListener Example .
* @param event instance of {@link ConfigChangeEvent}
@@ -41,8 +45,7 @@ public void onChange(ConfigChangeEvent event) {
Set changedKeys = event.changedKeys();
for (String changedKey : changedKeys) {
- System.out.printf("%s = %s \n", changedKey, event.getChange(changedKey));
+ LOG.info("{} = {}", changedKey, event.getChange(changedKey));
}
}
-
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
similarity index 96%
rename from spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
index e676cda9c..00ac67172 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.quickstart.callee;
+package com.tencent.cloud.quickstart.callee.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolver.java
similarity index 68%
rename from spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolver.java
index 06ff020a2..cdd4b97e0 100644
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolver.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolver.java
@@ -16,7 +16,7 @@
*
*/
-package com.tencent.cloud.ratelimit.example.service.callee;
+package com.tencent.cloud.quickstart.callee.ratelimit;
import java.util.HashMap;
import java.util.Map;
@@ -24,7 +24,10 @@
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.polaris.ratelimit.spi.PolarisRateLimiterLabelServletResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
@@ -34,14 +37,27 @@
*/
@Component
public class CustomLabelResolver implements PolarisRateLimiterLabelServletResolver {
+ private static final Logger LOG = LoggerFactory.getLogger(CustomLabelResolver.class);
+
+ @Value("${label.key-value:}")
+ private String[] keyValues;
@Override
public Map resolve(HttpServletRequest request) {
// rate limit by some request params. such as query params, headers ..
+ return getLabels(keyValues);
+ }
+
+ private Map getLabels(String[] keyValues) {
Map labels = new HashMap<>();
- labels.put("user", "zhangsan");
+ for (String kv : keyValues) {
+ String key = kv.substring(0, kv.indexOf(":"));
+ String value = kv.substring(kv.indexOf(":") + 1);
+ labels.put(key, value);
+ }
+ LOG.info("Current labels:{}", labels);
return labels;
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/bootstrap.yml
index 9acadf522..bf4d56b8f 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/bootstrap.yml
@@ -11,6 +11,16 @@ spring:
discovery:
enabled: true
register: true
+ contract:
+ exposure: true
+ report:
+ enabled: false
+ stat:
+ enabled: true
+ port: 28083
+ # pushgateway:
+ # enabled: true
+ # address: 127.0.0.1:9091
config:
address: grpc://119.91.66.223:8093
auto-refresh: true
@@ -19,8 +29,20 @@ spring:
files: [ "config/callee.properties" ]
ratelimit:
enabled: true
+ rejectRequestTipsFilePath: reject-tips.html
maxQueuingTime: 500
tencent:
metadata:
content:
+ label1: value1
region: huanan
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - polaris-discovery
+ - polaris-ratelimit
+ - polaris-config
+label:
+ key-value: user:zhangsan
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/resources/reject-tips.html b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/reject-tips.html
similarity index 100%
rename from spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/resources/reject-tips.html
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/resources/reject-tips.html
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
index e25650591..0f3495e9e 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/pom.xml
@@ -23,6 +23,11 @@
org.springframework.boot
spring-boot-starter-webflux
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
index 0baf9e208..86df17d59 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/QuickstartCalleeController.java
@@ -17,18 +17,26 @@
package com.tencent.cloud.quickstart.callee;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import com.tencent.cloud.common.constant.MetadataConstant;
+import com.tencent.cloud.quickstart.callee.config.DataSourceProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
+import static com.tencent.cloud.common.constant.ContextConstant.UTF_8;
+
/**
* Quickstart callee controller.
*
@@ -43,11 +51,16 @@ public class QuickstartCalleeController {
@Value("${server.port:0}")
private int port;
- @Value("${appName:Callee}")
+ @Value("${spring.cloud.client.ip-address:127.0.0.1}")
+ private String ip;
+
+ @Value("${appName:${spring.application.name}}")
private String appName;
@Autowired
private DataSourceProperties dataSourceProperties;
+ private boolean ifBadGateway = true;
+ private boolean ifDelay = true;
/**
* Get sum of two value.
@@ -57,7 +70,7 @@ public class QuickstartCalleeController {
*/
@GetMapping("/sum")
public int sum(@RequestParam int value1, @RequestParam int value2) {
- LOG.info("Quickstart Callee Service is called and sum is {}.", value1 + value2);
+ LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2);
return value1 + value2;
}
@@ -67,8 +80,23 @@ public int sum(@RequestParam int value1, @RequestParam int value2) {
*/
@GetMapping("/info")
public String info() {
- LOG.info("Quickstart [{}] Service [{}] is called. datasource = {}", appName, port, dataSourceProperties);
- return String.format("Quickstart [%s] Service [%s] is called. datasource = [%s]", appName, port, dataSourceProperties);
+ LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties);
+ return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties);
+ }
+
+ /**
+ * Get metadata in HTTP header.
+ *
+ * @param metadataStr metadata string
+ * @return metadata in HTTP header
+ * @throws UnsupportedEncodingException encoding exception
+ */
+ @RequestMapping("/echo")
+ public String echoHeader(@RequestHeader(MetadataConstant.HeaderName.CUSTOM_METADATA) String metadataStr)
+ throws UnsupportedEncodingException {
+ LOG.info(URLDecoder.decode(metadataStr, UTF_8));
+ metadataStr = URLDecoder.decode(metadataStr, UTF_8);
+ return metadataStr;
}
/**
@@ -77,9 +105,36 @@ public String info() {
* @return circuit break info
*/
@GetMapping("/circuitBreak")
- @ResponseStatus(value = HttpStatus.BAD_GATEWAY, reason = "failed for call quickstart callee service")
- public String circuitBreak() {
- LOG.info("Quickstart Callee Service [{}] is called wrong.", port);
- return String.format("Quickstart Callee Service [%s] is called wrong.", port);
+ public ResponseEntity circuitBreak() throws InterruptedException {
+ if (ifBadGateway) {
+ return new ResponseEntity<>("failed for call quickstart callee service.", HttpStatus.BAD_GATEWAY);
+ }
+ if (ifDelay) {
+ Thread.sleep(100);
+ }
+ LOG.info("Quickstart Callee Service [{}:{}] is called wrong.", ip, port);
+ return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is called wrong.", ip, port), HttpStatus.OK);
+ }
+
+ @GetMapping("/setBadGateway")
+ public void setBadGateway(@RequestParam boolean param) {
+ if (param) {
+ LOG.info("info is set to return HttpStatus.BAD_GATEWAY.");
+ }
+ else {
+ LOG.info("info is set to return HttpStatus.OK.");
+ }
+ this.ifBadGateway = param;
+ }
+
+ @GetMapping("/setDelay")
+ public void setDelay(@RequestParam boolean param) {
+ if (param) {
+ LOG.info("info is set to delay 100ms.");
+ }
+ else {
+ LOG.info("info is set to no delay.");
+ }
+ this.ifDelay = param;
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
similarity index 84%
rename from spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
index cf2e92017..bd2b1295b 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-a/src/main/java/com/tencent/cloud/quickstart/callee/CustomConfigChangeListener.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/CustomConfigChangeListener.java
@@ -15,12 +15,14 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.quickstart.callee;
+package com.tencent.cloud.quickstart.callee.config;
import java.util.Set;
import com.tencent.cloud.polaris.config.annotation.PolarisConfigKVFileChangeListener;
import com.tencent.cloud.polaris.config.listener.ConfigChangeEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -32,6 +34,8 @@
@Component
public final class CustomConfigChangeListener {
+ private static final Logger LOG = LoggerFactory.getLogger(CustomConfigChangeListener.class);
+
/**
* PolarisConfigKVFileChangeListener Example .
* @param event instance of {@link ConfigChangeEvent}
@@ -41,7 +45,7 @@ public void onChange(ConfigChangeEvent event) {
Set changedKeys = event.changedKeys();
for (String changedKey : changedKeys) {
- System.out.printf("%s = %s \n", changedKey, event.getChange(changedKey));
+ LOG.info("{} = {}", changedKey, event.getChange(changedKey));
}
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
similarity index 92%
rename from spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
index a0c6b7922..00ac67172 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/DataSourceProperties.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/config/DataSourceProperties.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.quickstart.callee;
+package com.tencent.cloud.quickstart.callee.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@@ -59,7 +59,7 @@ public void setPassword(String password) {
@Override
public String toString() {
return "jdbcUrl='" + jdbcUrl + '\'' +
- ", username='" + username + '\'' +
- ", password='" + password + '\'';
+ ", username='" + username + '\'' +
+ ", password='" + password + '\'';
}
}
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolverReactive.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolverReactive.java
similarity index 68%
rename from spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolverReactive.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolverReactive.java
index eb6e01b03..4a270fc62 100644
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/CustomLabelResolverReactive.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/CustomLabelResolverReactive.java
@@ -15,13 +15,16 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.ratelimit.example.service.callee;
+package com.tencent.cloud.quickstart.callee.ratelimit;
import java.util.HashMap;
import java.util.Map;
import com.tencent.cloud.polaris.ratelimit.spi.PolarisRateLimiterLabelReactiveResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
@@ -32,13 +35,26 @@
*/
@Component
public class CustomLabelResolverReactive implements PolarisRateLimiterLabelReactiveResolver {
+ private static final Logger LOG = LoggerFactory.getLogger(CustomLabelResolverReactive.class);
+
+ @Value("${label.key-value:}")
+ private String[] keyValues;
+
@Override
public Map resolve(ServerWebExchange exchange) {
// rate limit by some request params. such as query params, headers ..
+ return getLabels(keyValues);
+ }
+ private Map getLabels(String[] keyValues) {
Map labels = new HashMap<>();
- labels.put("user", "zhangsan");
+ for (String kv : keyValues) {
+ String key = kv.substring(0, kv.indexOf(":"));
+ String value = kv.substring(kv.indexOf(":") + 1);
+ labels.put(key, value);
+ }
+ LOG.info("Current labels:{}", labels);
return labels;
}
}
diff --git a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/JsonPolarisRateLimiterLimitedFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/JsonPolarisRateLimiterLimitedFallback.java
similarity index 95%
rename from spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/JsonPolarisRateLimiterLimitedFallback.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/JsonPolarisRateLimiterLimitedFallback.java
index c6979728b..9c8712870 100644
--- a/spring-cloud-tencent-examples/polaris-ratelimit-example/ratelimit-callee-service/src/main/java/com/tencent/cloud/ratelimit/example/service/callee/JsonPolarisRateLimiterLimitedFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/java/com/tencent/cloud/quickstart/callee/ratelimit/JsonPolarisRateLimiterLimitedFallback.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.ratelimit.example.service.callee;
+package com.tencent.cloud.quickstart.callee.ratelimit;
import com.tencent.cloud.polaris.ratelimit.spi.PolarisRateLimiterLimitedFallback;
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/resources/bootstrap.yml
index 467fc5a00..b5c7ec0bf 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-callee-service-b/src/main/resources/bootstrap.yml
@@ -11,6 +11,16 @@ spring:
discovery:
enabled: true
register: true
+ contract:
+ exposure: true
+ report:
+ enabled: false
+ stat:
+ enabled: true
+ port: 28084
+ # pushgateway:
+ # enabled: true
+ # address: 127.0.0.1:9091
config:
address: grpc://119.91.66.223:8093
auto-refresh: true
@@ -23,4 +33,15 @@ spring:
tencent:
metadata:
content:
+ label1: value2
region: huanan
+management:
+ endpoints:
+ web:
+ exposure:
+ include:
+ - polaris-discovery
+ - polaris-ratelimit
+ - polaris-config
+label:
+ key-value: user2:lisi
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
index 1fd0f5f53..cc72331c6 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/pom.xml
@@ -23,6 +23,21 @@
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/CustomMetadataProvider.java
similarity index 75%
rename from spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/CustomMetadataProvider.java
index 3b78eb3bc..002ad99a0 100644
--- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-caller-service/src/main/java/com/tencent/cloud/polaris/discovery/service/caller/DiscoveryCalleeServiceFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/CustomMetadataProvider.java
@@ -13,22 +13,23 @@
* 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.discovery.service.caller;
+package com.tencent.cloud.quickstart.caller;
+
+import com.tencent.cloud.common.spi.InstanceMetadataProvider;
import org.springframework.stereotype.Component;
/**
- * Discovery callee feign client fallback.
- *
- * @author Haotian Zhang
+ *@author lepdou 2022-06-29
*/
@Component
-public class DiscoveryCalleeServiceFallback implements DiscoveryCalleeService {
+public class CustomMetadataProvider implements InstanceMetadataProvider {
@Override
- public int sum(int value1, int value2) {
- return 0;
+ public String getRegion() {
+ return "huadong";
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeService.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeService.java
index 16486dfc9..58d4cc650 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeService.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeService.java
@@ -38,12 +38,4 @@ public interface QuickstartCalleeService {
*/
@GetMapping("/quickstart/callee/sum")
int sum(@RequestParam("value1") int value1, @RequestParam("value2") int value2);
-
- /**
- * Check circuit break.
- *
- * @return circuit break info
- */
- @GetMapping("/quickstart/callee/circuitBreak")
- String circuitBreak();
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeServiceFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeServiceFallback.java
index 546e503aa..1c806faac 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeServiceFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCalleeServiceFallback.java
@@ -31,9 +31,4 @@ public class QuickstartCalleeServiceFallback implements QuickstartCalleeService
public int sum(int value1, int value2) {
return 0;
}
-
- @Override
- public String circuitBreak() {
- return "An exception occurred in the service call and fallback";
- }
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerApplication.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerApplication.java
index 904a2a501..26fcb7eee 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerApplication.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerApplication.java
@@ -17,12 +17,17 @@
package com.tencent.cloud.quickstart.caller;
+import com.tencent.cloud.polaris.circuitbreaker.resttemplate.PolarisCircuitBreaker;
+import com.tencent.cloud.quickstart.caller.circuitbreaker.CustomFallback;
+
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;
/**
* Quickstart caller application.
@@ -42,4 +47,39 @@ public static void main(String[] args) {
public RestTemplate restTemplate() {
return new RestTemplate();
}
+
+ @Bean
+ @LoadBalanced
+ public RestTemplate defaultRestTemplate() {
+ DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://QuickstartCalleeService");
+ RestTemplate restTemplate = new RestTemplate();
+ restTemplate.setUriTemplateHandler(uriBuilderFactory);
+ return restTemplate;
+ }
+
+ @Bean
+ @LoadBalanced
+ @PolarisCircuitBreaker
+ public RestTemplate restTemplateFallbackFromPolaris() {
+ DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://QuickstartCalleeService");
+ RestTemplate restTemplate = new RestTemplate();
+ restTemplate.setUriTemplateHandler(uriBuilderFactory);
+ return restTemplate;
+ }
+
+ @Bean
+ @LoadBalanced
+ @PolarisCircuitBreaker(fallbackClass = CustomFallback.class)
+ public RestTemplate restTemplateFallbackFromCode() {
+ DefaultUriBuilderFactory uriBuilderFactory = new DefaultUriBuilderFactory("http://QuickstartCalleeService");
+ RestTemplate restTemplate = new RestTemplate();
+ restTemplate.setUriTemplateHandler(uriBuilderFactory);
+ return restTemplate;
+ }
+
+ @LoadBalanced
+ @Bean
+ WebClient.Builder webClientBuilder() {
+ return WebClient.builder().baseUrl("http://QuickstartCalleeService");
+ }
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerController.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerController.java
index 40b1233ab..a0c17faa2 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerController.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/QuickstartCallerController.java
@@ -22,6 +22,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -32,6 +33,7 @@
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.reactive.function.client.WebClient;
/**
* Quickstart caller controller.
@@ -43,11 +45,16 @@
public class QuickstartCallerController {
private static final Logger LOG = LoggerFactory.getLogger(QuickstartCallerController.class);
+
@Autowired
private RestTemplate restTemplate;
+
@Autowired
private QuickstartCalleeService quickstartCalleeService;
+ @Autowired
+ private WebClient.Builder webClientBuilder;
+
/**
* Get sum of two value.
* @param value1 value 1
@@ -72,9 +79,14 @@ public String rest() {
* Get information of callee.
* @return information of callee
*/
- @GetMapping("/circuitBreak")
- public String circuitBreak() {
- return quickstartCalleeService.circuitBreak();
+ @GetMapping("/webclient")
+ public Mono webclient() {
+ return webClientBuilder
+ .build()
+ .get()
+ .uri("/quickstart/callee/echo")
+ .retrieve()
+ .bodyToMono(String.class);
}
/**
@@ -150,8 +162,8 @@ public String unirate() throws InterruptedException {
}
/**
- * Get information of callee.
- * @return information of callee
+ * Get information of caller.
+ * @return information of caller
*/
@GetMapping("/info")
public String info() {
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerController.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerController.java
new file mode 100644
index 000000000..4d902aaa2
--- /dev/null
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerController.java
@@ -0,0 +1,136 @@
+/*
+ * 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.quickstart.caller.circuitbreaker;
+
+import reactor.core.publisher.Mono;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+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;
+
+/**
+ * Controller for circuit breaker.
+ *
+ * @author Haotian Zhang
+ */
+@RestController
+@RequestMapping("/quickstart/caller/circuitBreak")
+public class CircuitBreakerController {
+
+ @Autowired
+ private CircuitBreakerQuickstartCalleeService circuitBreakerQuickstartCalleeService;
+
+ @Autowired
+ private CircuitBreakerQuickstartCalleeServiceWithFallback circuitBreakerQuickstartCalleeServiceWithFallback;
+
+ @Autowired
+ @Qualifier("defaultRestTemplate")
+ private RestTemplate defaultRestTemplate;
+
+ @Autowired
+ @Qualifier("restTemplateFallbackFromPolaris")
+ private RestTemplate restTemplateFallbackFromPolaris;
+
+ @Autowired
+ @Qualifier("restTemplateFallbackFromCode")
+ private RestTemplate restTemplateFallbackFromCode;
+
+ @Autowired
+ private CircuitBreakerFactory circuitBreakerFactory;
+
+ @Autowired
+ private ReactiveCircuitBreakerFactory reactiveCircuitBreakerFactory;
+
+ @Autowired
+ private WebClient.Builder webClientBuilder;
+
+ /**
+ * Feign circuit breaker with fallback from Polaris.
+ * @return circuit breaker information of callee
+ */
+ @GetMapping("/feign/fallbackFromPolaris")
+ public String circuitBreakFeignFallbackFromPolaris() {
+ return circuitBreakerQuickstartCalleeService.circuitBreak();
+ }
+
+ /**
+ * Feign circuit breaker with fallback from Polaris.
+ * @return circuit breaker information of callee
+ */
+ @GetMapping("/feign/fallbackFromCode")
+ public String circuitBreakFeignFallbackFromCode() {
+ return circuitBreakerQuickstartCalleeServiceWithFallback.circuitBreak();
+ }
+
+ /**
+ * RestTemplate circuit breaker.
+ * @return circuit breaker information of callee
+ */
+ @GetMapping("/rest")
+ public String circuitBreakRestTemplate() {
+ return circuitBreakerFactory
+ .create("QuickstartCalleeService#/quickstart/callee/circuitBreak")
+ .run(() -> defaultRestTemplate.getForObject("/quickstart/callee/circuitBreak", String.class),
+ throwable -> "trigger the refuse for service callee."
+ );
+ }
+
+ /**
+ * RestTemplate circuit breaker with fallback from Polaris.
+ * @return circuit breaker information of callee
+ */
+ @GetMapping("/rest/fallbackFromPolaris")
+ public ResponseEntity circuitBreakRestTemplateFallbackFromPolaris() {
+ return restTemplateFallbackFromPolaris.getForEntity("/quickstart/callee/circuitBreak", String.class);
+ }
+
+ /**
+ * RestTemplate circuit breaker with fallback from code.
+ * @return circuit breaker information of callee
+ */
+ @GetMapping("/rest/fallbackFromCode")
+ public ResponseEntity circuitBreakRestTemplateFallbackFromCode() {
+ return restTemplateFallbackFromCode.getForEntity("/quickstart/callee/circuitBreak", String.class);
+ }
+
+ /**
+ * Get information of callee.
+ * @return information of callee
+ */
+ @GetMapping("/webclient")
+ public Mono webclient() {
+ return webClientBuilder
+ .build()
+ .get()
+ .uri("/quickstart/callee/circuitBreak")
+ .retrieve()
+ .bodyToMono(String.class)
+ .transform(it ->
+ reactiveCircuitBreakerFactory
+ .create("QuickstartCalleeService#/quickstart/callee/circuitBreak")
+ .run(it, throwable -> Mono.just("fallback: trigger the refuse for service callee"))
+ );
+ }
+}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeService.java
similarity index 74%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeService.java
index 63dbbdb17..64821b9a9 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderB.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeService.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.feign.example;
+package com.tencent.cloud.quickstart.caller.circuitbreaker;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@@ -25,14 +25,14 @@
*
* @author sean yu
*/
-@FeignClient(name = "polaris-circuitbreaker-callee-service", contextId = "fallback-from-polaris")
-public interface ProviderB {
+@FeignClient(name = "QuickstartCalleeService", contextId = "fallback-from-polaris")
+public interface CircuitBreakerQuickstartCalleeService {
/**
- * Get info of service B.
+ * Check circuit break.
*
- * @return info of service B
+ * @return circuit break info
*/
- @GetMapping("/example/service/b/info")
- String info();
+ @GetMapping("/quickstart/callee/circuitBreak")
+ String circuitBreak();
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceFallback.java
similarity index 76%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceFallback.java
index 419b18cfc..06a2df366 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceFallback.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.feign.example;
+package com.tencent.cloud.quickstart.caller.circuitbreaker;
import org.springframework.stereotype.Component;
@@ -25,10 +25,10 @@
* @author sean yu
*/
@Component
-public class ProviderBFallback implements ProviderBWithFallback {
+public class CircuitBreakerQuickstartCalleeServiceFallback implements CircuitBreakerQuickstartCalleeServiceWithFallback {
@Override
- public String info() {
- return "fallback: trigger the refuse for service b";
+ public String circuitBreak() {
+ return "fallback: trigger the refuse for service callee.";
}
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBWithFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceWithFallback.java
similarity index 66%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBWithFallback.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceWithFallback.java
index 194ac1305..f71a7650e 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-feign-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/feign/example/ProviderBWithFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CircuitBreakerQuickstartCalleeServiceWithFallback.java
@@ -15,25 +15,24 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.feign.example;
+package com.tencent.cloud.quickstart.caller.circuitbreaker;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
- * ProviderBWithFallback.
+ * CircuitBreakerQuickstartCalleeServiceWithFallback.
*
* @author sean yu
*/
-@FeignClient(name = "polaris-circuitbreaker-callee-service", contextId = "fallback-from-code", fallback = ProviderBFallback.class)
-public interface ProviderBWithFallback {
+@FeignClient(name = "QuickstartCalleeService", contextId = "fallback-from-code", fallback = CircuitBreakerQuickstartCalleeServiceFallback.class)
+public interface CircuitBreakerQuickstartCalleeServiceWithFallback {
/**
- * Get info of service B.
+ * Check circuit break.
*
- * @return info of service B
+ * @return circuit break info
*/
- @GetMapping("/example/service/b/info")
- String info();
-
+ @GetMapping("/quickstart/callee/circuitBreak")
+ String circuitBreak();
}
diff --git a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/CustomFallback.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CustomFallback.java
similarity index 95%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/CustomFallback.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CustomFallback.java
index a7f5f1a65..887d690d9 100644
--- a/spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-resttemplate-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/resttemplate/example/CustomFallback.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/circuitbreaker/CustomFallback.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.resttemplate.example;
+package com.tencent.cloud.quickstart.caller.circuitbreaker;
import java.util.HashMap;
diff --git a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomRouterLabelResolver.java b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/router/CustomRouterLabelResolver.java
similarity index 89%
rename from spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomRouterLabelResolver.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/router/CustomRouterLabelResolver.java
index be9b010ea..18f3d0cac 100644
--- a/spring-cloud-tencent-examples/polaris-router-example/router-caller-service/src/main/java/com/tencent/cloud/polaris/router/example/CustomRouterLabelResolver.java
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/java/com/tencent/cloud/quickstart/caller/router/CustomRouterLabelResolver.java
@@ -16,7 +16,7 @@
*
*/
-package com.tencent.cloud.polaris.router.example;
+package com.tencent.cloud.quickstart.caller.router;
import java.util.HashMap;
import java.util.Map;
@@ -42,9 +42,7 @@ public class CustomRouterLabelResolver implements FeignRouterLabelResolver {
public Map resolve(RequestTemplate requestTemplate, Set expressionLabelKeys) {
Map labels = new HashMap<>();
- User user = gson.fromJson(new String(requestTemplate.body()), User.class);
-
- labels.put("user", user.getName());
+ labels.put("label1", "value1");
return labels;
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/resources/bootstrap.yml
index d2d1347f4..b51cbdec5 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-caller-service/src/main/resources/bootstrap.yml
@@ -14,11 +14,15 @@ spring:
heartbeat:
enabled: true
health-check-url: /quickstart/caller/healthCheck
+ contract:
+ exposure: true
+ report:
+ enabled: false
circuitbreaker:
enabled: true
stat:
enabled: true
- port: 28081
+ port: 28082
# pushgateway:
# enabled: true
# address: 127.0.0.1:9091
@@ -39,3 +43,4 @@ management:
exposure:
include:
- polaris-discovery
+ - polaris-circuit-breaker
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/quickstart-example/quickstart-gateway-service/src/main/java/com/tencent/cloud/quickstart/gateway/FallbackController.java
similarity index 88%
rename from spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-gateway-example/src/main/java/com/tencent/cloud/polaris/circuitbreaker/gateway/example/FallbackController.java
rename to spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/java/com/tencent/cloud/quickstart/gateway/FallbackController.java
index c0d964b56..16dcc0ade 100644
--- 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/quickstart-example/quickstart-gateway-service/src/main/java/com/tencent/cloud/quickstart/gateway/FallbackController.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations under the License.
*/
-package com.tencent.cloud.polaris.circuitbreaker.gateway.example;
+package com.tencent.cloud.quickstart.gateway;
import reactor.core.publisher.Mono;
@@ -32,6 +32,6 @@ public class FallbackController {
@GetMapping("/polaris-fallback")
Mono getFallback() {
- return Mono.just("fallback: trigger the refuse for service b");
+ return Mono.just("fallback: trigger the refuse for service caller.");
}
}
diff --git a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/bootstrap.yml b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/bootstrap.yml
index 2f0b00cc2..0db7fd89a 100644
--- a/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/bootstrap.yml
+++ b/spring-cloud-tencent-examples/quickstart-example/quickstart-gateway-service/src/main/resources/bootstrap.yml
@@ -18,7 +18,33 @@ spring:
address: grpc://119.91.66.223:8091
namespace: default
enabled: true
+ contract:
+ exposure: true
+ report:
+ enabled: false
+ stat:
+ enabled: true
+ port: 28081
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:
+ # statusCodes 缺省时会自动识别 "5**" 为错误
+ # statusCodes: '''404,5**'''
+ # fallbackUri 缺省时会在熔断触发后拉取 plaris server 配置的降级作为 response
+ fallbackUri: '''forward:/polaris-fallback'''
routes:
- id: QuickstartCallerService
uri: lb://QuickstartCallerService