@HystrixCommand アノテーションを使用すると、メソッドが失敗した場合に実行するフォールバック メソッドを構成できます。
public Link defaultDogeLink(Account account) {
return null;
}
@HystrixCommand(fallbackMethod = "defaultDogeLink")
public Link buildDogeLink(Account account) {
// some code that may throw Runtime Exceptions
}
@HystrixCommand で注釈が付けられたすべてのメソッドでスローされたランタイム例外を (中央クラスで) ログに記録するにはどうすればよいですか?
バニラ hystrix-javanica ではなく、spring-cloud-netflix を使用しています。アプリケーションに実装する必要がある org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler クラス (Spring の @Async 用) に似たものを探しています。
hystrix-core では、HystrixCommand クラスにメソッドgetFailedExecutionException()があり、例外をログに記録するためのフォールバック メソッド内で使用できます。hystrix-javanica を使用しているときにこの例外を取得する方法を教えてもらえますか?