I managed to successfully get my RestTemplate client discover remote service using Eureka and forward calls to it using Ribbon as described in the documentation. Basically,
I couldn't get it to work with both @HystrixCommand and @Retryable, regardless of order of annotations on @Configuration class or on @Retryable method due to order of interceptors. I solved this by creating another class with the matching set of methods and had the @HystrixCommand annotated methods delegate to the corresponding @Retryable method in the second class. You could probably have the two classes implement the same interface. This is kind of a pain in the butt, but until order can be configured, this is all I could come up with. Still waiting on a real solution from Dave Syer and the spring cloud guys.
public class HystrixWrapper {
@Autowired
private RetryableWrapper retryableWrapper;
@HystrixCommand
public Response doSomething(...) {
return retryableWrapper.doSomething(...);
}
}
public class RetryableWrapper {
@Autowired
private RestTemplate restTemplate;
@Retryable
public Response doSomething(...) {
// do something with restTemplate;
}
}