With the @HystrixCommand annotation there can be configured a fallback method which should run in case that the method fails.
public Link defaultDogeLink(Account account) {
return null;
}
@HystrixCommand(fallbackMethod = "defaultDogeLink")
public Link buildDogeLink(Account account) {
// some code that may throw Runtime Exceptions
}
What should I do in order to log (in a central class) the runtime exceptions thrown in all the methods annotated with @HystrixCommand ?
I am using spring-cloud-netflix and not vanilla hystrix-javanica. I am looking for something similar to org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler class (for Spring's @Async) that i need to implement in my application.
In hystrix-core, the HystrixCommand class has the method getFailedExecutionException() which can be used within the fallback method for logging the exception. Can somebody maybe point me how to get this exception when working with hystrix-javanica?
@HystrixCommandis vanillahystrix-javanica, there are no spring extensions to it right now, so give his advice a try. - spencergibb