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 giving the remote service an opportunity to heal itself and come back online. Slamming a service in the middle of startup might be detrimental.
For example, if the images microservice's HomeController makes a call to comments, and...