@@ -25,7 +25,7 @@ Add the dependency on pom.xml
2525<dependency >
2626 <groupId >com.marcosbarbero.cloud</groupId >
2727 <artifactId >spring-cloud-zuul-ratelimit</artifactId >
28- <version >1.3.4 .RELEASE</version >
28+ <version >1.4.0 .RELEASE</version >
2929</dependency >
3030```
3131
@@ -137,9 +137,13 @@ Policy properties:
137137
138138Further Customization
139139---
140+ This section details how to add custom implementations
140141
141- If your application needs to control the key strategy beyond the options offered by the type property then you can
142- supply a custom `RateLimitKeyGenerator` implementation adding further qualifiers or something entirely different :
142+ # ## Key Generator
143+
144+ If the application needs to control the key strategy beyond the options offered by the type property then it can
145+ be done just by creating a custom `RateLimitKeyGenerator` implementation adding further qualifiers or something
146+ entirely different :
143147
144148` ` ` java
145149 @Bean
@@ -153,6 +157,36 @@ supply a custom `RateLimitKeyGenerator` implementation adding further qualifiers
153157 }
154158` ` `
155159
160+ # ## Error Handling
161+ This framework uses some 3rd party applications to store and control the rate limit access, as it does not has control
162+ over those applications and they can fail once a while the framework itself handles the failure in the class
163+ ` DefaultRateLimiterErrorHandler` just by adding some error logs.
164+
165+ If there is a need to handle the errors differently, it can be achieved just by defining a custom `RateLimiterErrorHandler`
166+ bean, e.g :
167+
168+ ` ` ` java
169+ @Bean
170+ public RateLimiterErrorHandler rateLimitErrorHandler() {
171+ return new DefaultRateLimiterErrorHandler() {
172+ @Override
173+ public void handleSaveError(String key, Exception e) {
174+ // custom code
175+ }
176+
177+ @Override
178+ public void handleFetchError(String key, Exception e) {
179+ // custom code
180+ }
181+
182+ @Override
183+ public void handleError(String msg, Exception e) {
184+ // custom code
185+ }
186+ }
187+ }
188+ ` ` `
189+
156190Contributing
157191---
158192Spring Cloud Zuul Rate Limit is released under the non-restrictive Apache 2.0 license, and follows a very
0 commit comments