Class RateLimiterMethodInterceptor

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

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

Given a method like this:


     @RateLimiter(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 RateLimiter according to the given config.

The fallbackMethod 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 Summary

    Constructors 
    Constructor Description
    RateLimiterMethodInterceptor()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation invocation)  

    Methods inherited from class io.github.resilience4j.ratpack.internal.AbstractMethodInterceptor

    completeFailedFuture, createRecoveryFunction, proceed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • invoke

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