We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pom.xml
org.springframework.boot spring-boot-starter-parent 2.7.14 com.circuitbreaker servicea 0.0.1-SNAPSHOT ServiceA Spring Boot circuit breaker 1.8 2021.0.8 org.springframework.boot spring-boot-starter-aop org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-devtools runtime true org.springframework.cloud spring-cloud-starter-circuitbreaker-resilience4j com.sun.jersey.contribs jersey-apache-client4 1.19.4 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin Java Code:-
@Autowired RestTemplate restTemplate;
private static final String BASE_URL = "http://localhost:9007/b";
private static final String SERVICE_A = "servicea";
@GetMapping @CIRCUITBREAKER(name = SERVICE_A, fallbackMethod = "serviceAFallback") public String serviceA() { return restTemplate.getForObject(BASE_URL, String.class); }
public String serviceAFallback(Exception e) { return "This is a fallback method for Service A"; }
Yaml File:- resilience4j: circuitbreaker: instances: servicea: registerHealthIndicator: true eventConsumerBufferSize: 10 failureRateThreshold: 50 minimumNumberOfCalls: 5 automaticTransitionFromOpenToHalfOpenEnabled: true waitDurationInOpenState: 5s permittedNumberOfCallsInHalfOpenState: 3 slidingWindowSize: 10 slidingWindowType: COUNT_BASED
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Pom.xml
org.springframework.boot spring-boot-starter-parent 2.7.14 com.circuitbreaker servicea 0.0.1-SNAPSHOT ServiceA Spring Boot circuit breaker 1.8 2021.0.8 org.springframework.boot spring-boot-starter-aop org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-devtools runtime true org.springframework.cloud spring-cloud-starter-circuitbreaker-resilience4j com.sun.jersey.contribs jersey-apache-client4 1.19.4 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin
Java Code:-
@Autowired
RestTemplate restTemplate;
private static final String BASE_URL = "http://localhost:9007/b";
private static final String SERVICE_A = "servicea";
@GetMapping
@CIRCUITBREAKER(name = SERVICE_A, fallbackMethod = "serviceAFallback")
public String serviceA() {
return restTemplate.getForObject(BASE_URL, String.class);
}
public String serviceAFallback(Exception e) {
return "This is a fallback method for Service A";
}
Yaml File:-
resilience4j:
circuitbreaker:
instances:
servicea:
registerHealthIndicator: true
eventConsumerBufferSize: 10
failureRateThreshold: 50
minimumNumberOfCalls: 5
automaticTransitionFromOpenToHalfOpenEnabled: true
waitDurationInOpenState: 5s
permittedNumberOfCallsInHalfOpenState: 3
slidingWindowSize: 10
slidingWindowType: COUNT_BASED
The text was updated successfully, but these errors were encountered: