I've set a couple of retry configurations in my application.properties
file. However, none of them is working when I ran the ribbon application.
//this is my service
@RestController
@SpringBootApplication
public class HelloApplication {
@Value("${server.port}")
private int port;
public static void main(String[] args) {
SpringApplication.run(HelloApplication .class, args);
}
@GetMapping(value="/app")
public String notification() {
return "This Is HelloService running on port:"+ port;
}
}
Here is my RibbonAppApplication
class:
@SpringBootApplication(scanBasePackages={"com.netflix.client.config.IClientConfig"})
@RestController
@RibbonClient(name= "hello", configuration=RibbonConfig.class )
public class RibbonAppApplication {
@Autowired
private RestTemplate restTemplate;
public static void main(String[] args) {
SpringApplication.run(RibbonAppApplication.class, args);
}
@GetMapping
public String getService() {
return restTemplate.getForObject("http://hello/app",String.class);
}
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
This is the application.properties
for the RibbonAppApplication
:
ribbon.eureka.enabled=false
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
hello.ribbon.listOfServers=http://localhost:1111, http://localhost:2222
hello.ribbon.OkToRetryOnAllOperations=false
hello.ribbon.MaxAutoRetries=0
hello.ribbon.MaxAutoRetriesNextServer=1
Thank you guys so much for helping!