Implementing microservice circuit breakers

The ability to invoke a remote microservice comes with an implicit risk--there is always a chance that the remote service is down.

Remember using @SpringCloudApplication? As a reminder, that annotation contains:

    @SpringBootApplication 
    @EnableDiscoveryClient 
    @EnableCircuitBreaker 
    public @interface SpringCloudApplication { 
    } 

The last annotation, @EnableCircuitBreaker, enables Netflix Hystrix, the circuit breaker solution (http://martinfowler.com/bliki/CircuitBreaker.html).

In short, a circuit breaker is something that, when it detects a certain threshold of failure, will open the circuit and prevent any future remote calls for a certain amount of time. The purpose is to prevent cascade failures while ...

Get Learning Spring Boot 2.0 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.