Home | Source for Kata

Circuit Breaker pattern

This Kata is based on the assumption that you’re running the Config service, Eureka service (Kata6) and Profiles Service (Kata6) in Docker.
Under constructions

Enabling Hystrix in your application

Make sure that you have Actuator in your class-path

accounts-service/build.gradle
compile("org.springframework.boot:spring-boot-starter-actuator:$springBootVersion")

Add Hystrix to your application’s class-path:

accounts-service/build.gradle
compile("org.springframework.cloud:spring-cloud-starter-hystrix:$springCloudVersion")

Annotate your application with @EnableHystrix:

src/main/java/msvcdojo/AccountServiceApplication.java
@EnableHystrix
public class AccountsServiceApplication {

    public static void main(String[] args) {

        SpringApplication.run(AccountsServiceApplication.class, args);
    }
}

Open http://dockerhost:7980 to get to the Hystrix dashboard:

hystrix dashboard

Stressing circuit breakers

Under construction

No problems detected in the application - everything is normal:

hystrix dashboard stream

When one of the dependencies goes down, system detects errors - note red circle and error count:

hystrix dashboard stream error

When the amount of errors goes over a threshold - circuit breaker trips (notice "Open" status):

hystrix dashboard stream error open

Turbine dashboard

Under construction