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
Haotian Zhang d10752a70d
docs:optimize example (#385)
2 years ago
..
polaris-circuitbreaker-example-a docs:optimize example (#385) 2 years ago
polaris-circuitbreaker-example-b docs:optimize example (#385) 2 years ago
polaris-circuitbreaker-example-b2 docs:optimize example (#385) 2 years ago
README-zh.md optimize example 3 years ago
README.md optimize example 3 years ago
pom.xml optimize example 3 years 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.