@Service public class DepartmentService { @Autowired RestTemplate restTemplate; // @HystrixCommand(fallbackMethod = "fallbackGetDepartmentDetails", commandProperties = { // @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "110"), // @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"), // @HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "20"), // @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "5000") }) @HystrixCommand(fallbackMethod = "fallbackGetDepartmentDetails", threadPoolKey = "threadPoolDepartmentDetails", threadPoolProperties = { @HystrixProperty(name = "coreSize", value = "15"), @HystrixProperty(name = "maxQueueSize", value = "5") }) public DepartmentResponse getDepartmentDetails(String departURL) { return restTemplate.getForObject(departURL, DepartmentResponse.class); } public DepartmentResponse fallbackGetDepartmentDetails(String departURL) { DepartmentDetail dd1 = new DepartmentDetail(1, "HR", Collections.singletonList(new EmployeeDetail(1, "Colean"))); DepartmentDetail dd2 = new DepartmentDetail(2, "Marketing", Collections.singletonList(new EmployeeDetail(2, "Richard"))); DepartmentResponse departmentResponse = new DepartmentResponse(); departmentResponse.getDepartmentDetails().add(dd1); departmentResponse.getDepartmentDetails().add(dd2); return departmentResponse; } }