Replace hystrixruntimeexception in resilience4j

19 views
Skip to first unread message

P Terziev

unread,
May 2, 2024, 7:07:41 AM5/2/24
to HystrixOSS
I have this Hystrix code which I want to migrate to resilience4j:

      @ExceptionHandler(HystrixRuntimeException.class)
      public ResponseEntity<?> handleHystrixException(HystrixRuntimeException hystrixException) {
   
        if (HystrixRuntimeException.FailureType.TIMEOUT == hystrixException.getFailureType()) {
          return new InternalTimeoutException();
        }
      }


I tried this:

 

      @ExceptionHandler(HystrixRuntimeException.class)
      public ResponseEntity<?> handleHystrixException(HystrixRuntimeException hystrixException) {
   
        if (hystrixException.getCause().getCause() instanceof TimeoutException) {
          return new InternalTimeoutException();
        }
      }

I can't find how to replace HystrixRuntimeException in resilience4j. Do you know how it should be replaced?

Reply all
Reply to author
Forward
0 new messages