some docs required
This Lib looks exactly to what I was looking for, but the lack of documentation makes it difficult to get started. A quick example on how to use the APIs to limit REST calls should be enough. Also Spring Boot integration will be quite handy.
Pull requests welcome!
There are some simple examples found within the project such as https://github.com/mokies/ratelimitj/tree/master/ratelimitj-redis . What exactly did you find confusing?
I second @Salaboy. A servlet filter implementation sample would help heaps.
For example, if you aren't familiar with Reactive it isn't straightforward hot to implement a non-blocking API Rate Limiter, which I believe is a common use case for ratelimitj. Thanks
Hi @fsamire and @Salaboy,
Apologies for the long delay in replying. I have put together a very simple Servlet example to assist you, see https://github.com/mokies/ratelimitj/blob/master/ratelimitj-examples/src/main/java/ServletRateLimitedExample.java
Something that would help a lot (IMHO) are javadocs for the interfaces. Look at Baton for example:
public interface Baton {
void release();
<T> Optional<T> get(Supplier<T> action);
void doAction(Runnable action);
boolean hasAcquired();
}
What is a Baton? What guarantees does it make (and not make)? What do any of these methods do? (The doAction is especially puzzling here. When does it invoke the Runnable? What does it do before/after that? Does it behave differently if the baton is acquired or not? What if the Runnable throws an exception?)
I can infer much of this by looking at the existing implementations, but it's annoying to have to do that every time I need a refresher on how Baton objects work, and if I need to create my own implementation, I'm pretty much just guessing at the contract I'm supposed to be following.
READMEs and tutorials are nice to get people started, but javadocs are necessary for day-to-day work. I just want to navigate to Baton in my IDE and see the docs there.