Replies: 4 comments
-
For the local hooks the fallbackMethod can be used. Doesn't it suits your use case? We can support an additional parameter with further information will will automatically be filled. @RateLimiting(
fallbackMethodName = "myFallbackMethod")
public String execute(String username) {
log.info("Method with Param {} executed", username);
return username;
}
// the fallback method must have the same signature
public String myFallbackMethod(String username, RateLimitInformation info) {
log.info("Fallback-Method with Param {} executed with informations {}", username, info);
return username;
} For the Servlets you can Implement the Interface MetricHandler and provide your custom code. What are you missing here? |
Beta Was this translation helpful? Give feedback.
-
The idea was to do something when the rate limit applied / not applied like putting some information into a database, write a special log-entry or something like that. Lets call it "cross-sectional-tasks", something which you man not want to implement every time again and again in the annotated method and the fallback method again, similar to the default metrics for filters. |
Beta Was this translation helpful? Give feedback.
-
That was the purpose of the MetricHandler. Why doesn't it suits your needs? Maybe we can use a better name? |
Beta Was this translation helpful? Give feedback.
-
Currently I'm quite unsure what my usecase is and if the MetricHandlers are enough. So I close this discussion to prevent confution (even on my side ;) ). |
Beta Was this translation helpful? Give feedback.
-
I would like to have hooks to register custom code which is executed when a rateLimit applied / did not apply.
It would be nice to register global hooks (maybe like metric handlers?) and lokal hooks.
Example global hook:
Example local hook:
Is this a stupid idea? What would be the best way to implement this? Each hook is a SpEL expression? A Hook interface and several implementations?
Beta Was this translation helpful? Give feedback.
All reactions