Hystrix (Circuit Breaker )

Hystrix in spring cloud is the implementation of Circuit Breaker pattern, which gives a control over latency and failure between distributed micro services. Here main idea is to stop cascading failures by failing fast and recover as soon as possible. Netflix created Hystrix library implementing the Circuit Breaker pattern to address these kinds of issues. Step1 : Add the Hystrix starter to your spring project <dependency>     <groupId>org.springframework.cloud</groupId>     <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> Step2 : Enable the Circuit Breaker by adding annotation to your project @EnableCircuitBreaker Step3 : Now we can use @HystrixCommand annotation on any method we want to apply timeout and fallback method. The fallback method should be defined in the same class and should have the same signature. public class ServiceClient { private final RestTemplate restTemplate; @Autowired     public ServiceClient(RestTemplate restTemplate) {         this.restTemplate = restTemplate;     }     @HystrixCommand(fallbackMethod =… Read more“Hystrix (Circuit Breaker )”