You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-cloud-tencent/spring-cloud-tencent-examples/polaris-circuitbreaker-example
Shanyou Yu (Sean Yu) 776a646e81
feature: improve circuit breaker usage (#917)
1 year ago
..
polaris-circuitbreaker-callee-service feature: improve circuit breaker usage (#917) 1 year ago
polaris-circuitbreaker-callee-service2 feature: improve circuit breaker usage (#917) 1 year ago
polaris-circuitbreaker-feign-example feature: improve circuit breaker usage (#917) 1 year ago
polaris-circuitbreaker-gateway-example feature: improve circuit breaker usage (#917) 1 year ago
polaris-circuitbreaker-resttemplate-example feature: improve circuit breaker usage (#917) 1 year ago
polaris-circuitbreaker-webclient-example feature:add polaris circuit breaker support (#882) 1 year ago
README-zh.md optimize example 2 years ago
README.md optimize example 2 years ago
pom.xml feature:add polaris circuit breaker support (#882) 1 year ago

README.md

Spring Cloud Polaris CircuitBreaker Example

Example Introduction

This example shows how to usespring-cloud-starter-tencent-polaris-circuitbreaker in Spring Cloud project and other features

This example is divided to two microservice, polaris-circuitbreaker-example-a and polaris-circuitbreaker-example-b. In these two microservices, polaris-circuitbreaker-example-a invokes polaris-circuitbreaker-example-b.

Instruction

Configuration

The configuration is as the following shows. {ip} and {port} are Polaris backend IP address and port number.

spring:
  application:
    name: ${application.name}
  cloud:
    polaris:
      address: ${ip}:${port}

###Launching Example

###Launching Polaris Backend Service

Reference to Polaris Getting Started

####Launching Application

Note, because verification is needed for circuit-break feature, therefore, one needs to deploy more than two invoked services (two deployment in this example)

Launchingspring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-a's ServiceA and spring-cloud-tencent-examples/polaris-circuitbreaker-example/polaris-circuitbreaker-example-b's ServiceB

note, Service B needs to launch two. One can adjust the port on the same machine.

Two Services B's com.tencent.cloud.polaris.circuitbreaker.example.ServiceBController.info logics are different. One returns normally, one is abnormal.

  • Maven Package Launching

Execute under spring-cloud-tencent-examples/polaris-discovery-example

note, Service B needs to launch two. One can adjust the port on the same machine.

Two Services B's com.tencent.cloud.polaris.circuitbreaker.example.ServiceBController.info logics are different. One returns normally, one is abnormal.

mvn clean package

Then under polaris-circuitbreaker-example-a``` and polaris-circuitbreaker-example-b``` find the package that generated 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, the logic is ServiceB has an abnormal signal

curl -L -X GET 'localhost:48080/example/service/a/getBServiceInfo'

Expected return condition:

when appear

trigger the refuse for service b

it means the request signals abnormal ServiceB, and will ciruitbreak this instance, the later requests will return normally.