Hystrix payment service degradation fallback measure

1.pom file

 

<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>

2.YML file

 

server:
port: 8001
spring:
application:
name: cloud-provider-hystrix-payment #服务名
Eureka: 
Client:
# Indicates whether to register into its own EurekaServer default is true
the Register-with-Eureka: true
# crawled whether existing registration information from EurekaServer, the default is true, it does not matter single-node cluster with ribbon must be set to true to load-balancing
FETCH-Registry: to true
Service-url:
defaultzone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eureka # cluster Edition
#defaultZone: http: // localhost: 7001 / eureka stand-alone version

3. Start class

 

@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
public class PaymentMainHystrix8001 {
public static void main(String[] args) {
SpringApplication.run(PaymentMainHystrix8001.class,args);
}
}

4, the business class

 

 

 

5. Control layer

 

 

 



5. Control layer

Guess you like

Origin www.cnblogs.com/fuqiang-zhou/p/12612213.html