You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add response predicate to retry sync and async for enhancement ReactiveX#259
* ReactiveX#348 add sync retry spring boot annotation and config support for spring boot 1 and 2
* ReactiveX#348 add sync retry spring boot annotation and config support for spring boot 1 and 2
* ReactiveX#348 adding java doc
* ReactiveX#348 adding java doc
* ReactiveX#348 adding spring override bean option for the retry spring boot starters
* ReactiveX#348 adding spring async retry aspect support
* ReactiveX#348 adding annotation validation protection of using retry and async retry annotation together in the class level
* ReactiveX#348 updating java doc
* ReactiveX#348 adding the new prefix of async retry metrics and fixing the merge conflicts
* ReactiveX#348 covering review comments
* ReactiveX#348 removing unneeded lines
* ReactiveX#348 adding the updated spring boot documentation for the retry spring boot usage for spring boot 1 and 2
* ReactiveX#348 documentation review comments
* ReactiveX#348 documentation review comments and removing health indicators for retry support in spring boot
* ReactiveX#348 documentation review comments
When you want to publish Retry/AsyncRetry endpoints on the Prometheus endpoint, you have to add the dependency `io.micrometer:micrometer-registry-prometheus`.
46
+
and you have same metrics exposed there , check circuit breaker below for more information about the example.
47
+
24
48
==== CircuitBreaker
25
49
This demo publishes the status and metrics of all CircuitBreakers via a custom `CircuitBreakerHealthIndicator`.
26
50
A closed CircuitBreaker state is mapped to UP, an open state to DOWN and a half-open state to UNKNOWN.
@@ -133,6 +157,67 @@ For example:
133
157
134
158
==== Configuration
135
159
160
+
===== Retry
161
+
You can configure your Retries in Spring Boot's `application.yml` config file.
- By default the same back end configuration will be used for sync and async retry configuration if not defined otherwise.
185
+
- enableRandomizedWait and enableExponentialBackoff is false by default.
186
+
- You can not enable both enableRandomizedWait and enableExponentialBackoff , validation exception will be thrown if it happen.
187
+
- If exponentialBackoffMultiplier is not provided if enableExponentialBackoff is enabled , default ExponentialBackoff will be used , same story for enableRandomizedWait.
188
+
189
+
The rules for Retry spring annotation usage :
190
+
191
+
- You can use the same back-end configuration for both sync and async retry if you use both annotations in for the same backed method level wise only ,
192
+
if you mix annotations between class level and method level on the same back-end class , validation exception will be thrown
193
+
- For `AsyncRetry` annotation , please make sure the return type is instance of Java `CompletionStage` otherwise runtime exception will be thrown
194
+
195
+
Code example of retry and async retry annotation usage in Java Spring component :
196
+
[source,java]
197
+
----
198
+
@component
199
+
public class RetryDummyServiceImpl implements RetryDummyService {
200
+
201
+
@Retry(name = RetryDummyService.BACKEND)
202
+
@Override
203
+
public void doSomething(boolean throwBackendTrouble) throws IOException {
204
+
if (throwBackendTrouble) {
205
+
throw new IOException("Test Message");
206
+
}
207
+
}
208
+
209
+
@AsyncRetry(name = RetryDummyService.BACKEND)
210
+
@Override
211
+
public CompletionStage<String> doSomethingAsync(boolean throwException) throws IOException {
You can configure your CircuitBreakers in Spring Boot's `application.yml` config file.
138
223
For example
@@ -197,6 +282,82 @@ WARNING: Please be careful changing of `CircuitBreaker`/`RateLimiter` ordering c
197
282
198
283
==== Event Monitoring
199
284
285
+
===== Retry
286
+
287
+
The emitted Retry events are stored in a separate circular event consumer buffers. The size of a event consumer buffer can be configured per Retry in the application.yml file (eventConsumerBufferSize).
288
+
The demo adds a custom Spring Boot Actuator endpoint which can be used to monitor the emitted events of your Retries.
289
+
The endpoint `/management/retries` lists the names of all Retries instances.
290
+
For example:
291
+
----
292
+
{
293
+
"retries": [
294
+
"retryBackendA",
295
+
"retryBackendA"
296
+
]
297
+
}
298
+
----
299
+
300
+
The endpoint `/management/retries/events` lists the latest 100 emitted events of all Retries instances.
"errorMessage": "java.io.IOException: Test Message",
355
+
"numberOfAttempts": 3
356
+
}
357
+
]
358
+
}
359
+
----
360
+
200
361
===== CircuitBreaker
201
362
202
363
The emitted CircuitBreaker events are stored in a separate circular event consumer buffers. The size of a event consumer buffer can be configured per CircuitBreaker in the application.yml file (eventConsumerBufferSize).
0 commit comments