Class CircuitBreakerMethodInterceptor

java.lang.Object
io.github.resilience4j.ratpack.internal.AbstractMethodInterceptor
io.github.resilience4j.ratpack.circuitbreaker.CircuitBreakerMethodInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class CircuitBreakerMethodInterceptor
extends AbstractMethodInterceptor
A MethodInterceptor to handle all methods annotated with CircuitBreaker. It will handle methods that return a Promise, Flux, Mono, CompletionStage, or value.

The CircuitBreakerRegistry is used to retrieve an instance of a CircuitBreaker for a specific name.

Given a method like this:


     @CircuitBreaker(name = "myService")
     public String fancyName(String name) {
         return "Sir Captain " + name;
     }
 
each time the #fancyName(String) method is invoked, the method's execution will pass through a a CircuitBreaker according to the given config.

The fallbackMethod parameter signature must match either:

1) The method parameter signature on the annotated method or 2) The method parameter signature with a matching exception type as the last parameter on the annotated method

The return value can be a Promise, CompletionStage, Flux, Mono, or an object value. Other reactive types are not supported.

If the return value is one of the reactive types listed above, it must match the return value type of the annotated method.

  • Constructor Details

  • Method Details

    • invoke

      @Nullable public java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable
      Throws:
      java.lang.Throwable