Class CircuitBreakerAspect
- java.lang.Object
-
- io.github.resilience4j.circuitbreaker.configure.CircuitBreakerAspect
-
- All Implemented Interfaces:
org.springframework.core.Ordered
public class CircuitBreakerAspect extends java.lang.Object implements org.springframework.core.OrderedThis Spring AOP aspect intercepts all methods which are annotated with aCircuitBreakerannotation. The aspect will handle methods that return a RxJava2 reactive type, Spring Reactor reactive type, CompletionStage type, or value type.The CircuitBreakerRegistry is used to retrieve an instance of a CircuitBreaker for a specific name.
Given a method like this:
each time the@CircuitBreaker(name = "myService") public String fancyName(String name) { return "Sir Captain " + name; }#fancyName(String)method is invoked, the method's execution will pass through a aCircuitBreakeraccording 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
-
-
Constructor Summary
Constructors Constructor Description CircuitBreakerAspect(CircuitBreakerConfigurationProperties circuitBreakerProperties, io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry circuitBreakerRegistry, java.util.List<CircuitBreakerAspectExt> circuitBreakerAspectExtList, FallbackDecorators fallbackDecorators, SpelResolver spelResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcircuitBreakerAroundAdvice(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker circuitBreakerAnnotation)intgetOrder()voidmatchAnnotatedClassOrMethod(io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker circuitBreaker)
-
-
-
Constructor Detail
-
CircuitBreakerAspect
public CircuitBreakerAspect(CircuitBreakerConfigurationProperties circuitBreakerProperties, io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry circuitBreakerRegistry, @Autowired(required=false) java.util.List<CircuitBreakerAspectExt> circuitBreakerAspectExtList, FallbackDecorators fallbackDecorators, SpelResolver spelResolver)
-
-
Method Detail
-
matchAnnotatedClassOrMethod
public void matchAnnotatedClassOrMethod(io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker circuitBreaker)
-
circuitBreakerAroundAdvice
public java.lang.Object circuitBreakerAroundAdvice(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint, @Nullable io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker circuitBreakerAnnotation) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
-