Skip to content
New issue

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

Resilience4j is not working with java version 1.8 and Spring boot 2.7.14 and spring cloud version 2021.0.8 #4

Open
janardhan521 opened this issue Aug 3, 2023 · 0 comments

Comments

@janardhan521
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant