chaos-monkey and spring hystrix incompatible?

241 Views Asked by At

I want to use chaos monkey to assault my microservice and I want to use hystrix to hanlde failure. When I use chaos monkey alone, my app receive assaults but when I use hystrix with it, then chaos monkey is not doing any assault.

Why can't I use both? Is it a version problem?

@SpringBootApplication
@EnableCircuitBreaker
public class App {
    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }
}

@RestController
public class Controller {

    @Autowired
    private Service service;

    @RequestMapping("/list")
    public List<String> getList() {
        return service.getList();
    }
}

@Service
public class Service {

    @Autowired
    private Repo repo;

    @HystrixCommand(fallbackMethod = "reliable")
    public List<String> getList() {
        return repo.getList();
    }

    public List<String> reliable() {
        return Arrays.asList("ONE", "TWO", "THREE");
    }
}

@Repository
public class Repo {
    public List<String> getList() {
        return Arrays.asList("Java", "PHP", "C++");
    }
}

Application.properties
spring.profiles.active=chaos-monkey
chaos.monkey.enabled=true
chaos.monkey.watcher.controller=false
chaos.monkey.watcher.restController=false
chaos.monkey.watcher.service=true
chaos.monkey.watcher.repository=false
chaos.monkey.assaults.latencyActive=false
chaos.monkey.assaults.exceptions-active=true
0

There are 0 best solutions below