resilience4j / resilience4j-micronaut-demo

A Micronaut demo which shows how to use the Resilience4j
12 stars 11 forks source link

Demo of rate limiting for the HTTP client #1

Open lightbody opened 5 years ago

lightbody commented 5 years ago

Hi there!

Thanks for starting this. If you come back to this project, I'd love to see an example of how to apply rate limiting to Micronaut's HTTP client. I'm especially curious about exploring Micronaut's declarative client and whether their @Retry advice is good to pair with reslience4j or whether I'm better off avoiding it in favor of a 100% resilience4j-based solution.

In my particular case, I have an API that returns X-Rate-Limit-Remaining and X-Rate-Limit-Reset to tell me how many more calls I can make and when the rate limit resets (ex: 45 calls left in the next 29 seconds). So ideally my solution runs fast at the start of a window and throttles back just enough to get to 1 call remaining in the next 1 seconds.

RobWin commented 5 years ago

Sry, I was on vacation. I think you won't be able to use Micronauts @Retryable annotation and their advice with resiliencej4. We have to create our our advice and annotation.