Search in sources :

Example 1 with RateLimited429EnforcerFeature

use of es.moki.ratelimij.dropwizard.filter.RateLimited429EnforcerFeature in project ratelimitj by mokies.

the class RateLimitBundle method run.

@Override
public void run(final Configuration configuration, final Environment environment) {
    environment.jersey().register(new RateLimitingFactoryProvider.Binder(requestRateLimiterFactory));
    environment.jersey().register(new RateLimited429EnforcerFeature());
    environment.lifecycle().manage(new Managed() {

        @Override
        public void start() {
        }

        @Override
        public void stop() throws Exception {
            requestRateLimiterFactory.close();
        }
    });
}
Also used : RateLimited429EnforcerFeature(es.moki.ratelimij.dropwizard.filter.RateLimited429EnforcerFeature) Managed(io.dropwizard.lifecycle.Managed)

Aggregations

RateLimited429EnforcerFeature (es.moki.ratelimij.dropwizard.filter.RateLimited429EnforcerFeature)1 Managed (io.dropwizard.lifecycle.Managed)1