Class BulkheadAspect
java.lang.Object
io.github.resilience4j.bulkhead.configure.BulkheadAspect
- All Implemented Interfaces:
org.springframework.core.Ordered
public class BulkheadAspect
extends java.lang.Object
implements org.springframework.core.Ordered
This Spring AOP aspect intercepts all methods which are annotated with a
Bulkhead
annotation. The aspect will handle methods that return a RxJava2 reactive type, Spring Reactor
reactive type, CompletionStage type, or value type.
The BulkheadRegistry is used to retrieve an instance of a Bulkhead for a specific name.
Given a method like this:
@Bulkhead(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 Bulkhead 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
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BulkheadAspect(BulkheadConfigurationProperties backendMonitorPropertiesRegistry, io.github.resilience4j.bulkhead.ThreadPoolBulkheadRegistry threadPoolBulkheadRegistry, io.github.resilience4j.bulkhead.BulkheadRegistry bulkheadRegistry, java.util.List<BulkheadAspectExt> bulkheadAspectExts, FallbackDecorators fallbackDecorators, SpelResolver spelResolver) -
Method Summary
Modifier and Type Method Description java.lang.ObjectbulkheadAroundAdvice(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.bulkhead.annotation.Bulkhead bulkheadAnnotation)intgetOrder()voidmatchAnnotatedClassOrMethod(io.github.resilience4j.bulkhead.annotation.Bulkhead Bulkhead)
-
Constructor Details
-
BulkheadAspect
public BulkheadAspect(BulkheadConfigurationProperties backendMonitorPropertiesRegistry, io.github.resilience4j.bulkhead.ThreadPoolBulkheadRegistry threadPoolBulkheadRegistry, io.github.resilience4j.bulkhead.BulkheadRegistry bulkheadRegistry, @Autowired(required=false) java.util.List<BulkheadAspectExt> bulkheadAspectExts, FallbackDecorators fallbackDecorators, SpelResolver spelResolver)
-
-
Method Details
-
matchAnnotatedClassOrMethod
public void matchAnnotatedClassOrMethod(io.github.resilience4j.bulkhead.annotation.Bulkhead Bulkhead) -
bulkheadAroundAdvice
public java.lang.Object bulkheadAroundAdvice(org.aspectj.lang.ProceedingJoinPoint proceedingJoinPoint, @Nullable io.github.resilience4j.bulkhead.annotation.Bulkhead bulkheadAnnotation) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-