Below is my Hystrix command configuration:
@HystrixCommand(fallbackMethod = "fall", commandProperties = {
@HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "5"),
@HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "10000") })
public <T> T getInfo(Class clazz) {....}
Fallback method:
public <T> T fall(Class clazz) {
System.out.println("fallback");
throw new CustomRuntimeException("API Down");
}
I understand that as per the below configuration i.e.
@HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "5"),
@HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "10000") }
5 request would be allowed in 10s until the circuit trips open and every request from 5th request would be rejected and as i am throwing an exception in the fallback method it would be wrapped as HystrixRuntimeException.
But i am facing below issue:
- Until the circuit trips open the fallback is executing normally and
throwing
CustomRuntimeException(Note: Hystrix Command method also throwsCustomRuntimeException) - After the circuit trips open i getting
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: getInfo short-circuited and fallback failed.
Question:
- Why the exception is not wrapped as HystrixRuntimeException before the circuit is open i.e. Currently the fallback is executed normally and throws CustomRuntimeException until the circuit gets open?*
- Why in flow 1->2->3->4->5->6->8 the fallback method is executed even after
failing (i.e. Throwing
CustomRuntimeException) and does not throws a wrappedHystrixRuntimeException, which is happening in the case of flow 1->2->3->4->8 and 1->2->3->5->8
