Home > other >  In Hystrix trigger back custom error conditions
In Hystrix trigger back custom error conditions

Time:11-30


According to understand, Hystrix back logic in some situations trigger, such as request timeout, thread pool, with 100% of the capacity of running or dependencies throws an exception, in addition to the three factors, I can add more conditions, these conditions is also considered a failure, such as 413 (such as the load is too big) any specific HTTP error code?






CodePudding user response:


Porcupine alternate methods will be under the following conditions is called

Open
The signal/thread pool refused to
Failure (exclude HystrixBadRequestException in the way you throw any exceptions)
Your method (hystrix overtime timeout)

Only some temporary t is directly related to the user code execution fails,
In this case, the back will be for the run () method to throw any exceptions, pure Hystrix by HystrixCommand and Hystrix Javanica via annotations are exactly the same,
With one exception, it won't trigger HystrixBadRequestException
So, if you want to also triggers the back of the HTTP status code of 413, you have to just throw any exceptions in your methods,
If you are using any built-in Hystrix support (such as a Spring Cloud Feign) in the library, you need some of the things necessary to achieve the library, in the Spring Cloud Feign, you can implement your own ErrorDecoder, default error decoder will trigger all 4 xx, xx may wrong backup, if you don't want to trigger any back 4 except 413 xx error, in which you can input HystrixBadRequestException,

CodePudding user response:

Inheritance HystrixCommand class run method can throw an exception
  • Related