-
Notifications
You must be signed in to change notification settings - Fork 136
Retry functionality in SimpleReact
johnmcclean-aol edited this page Feb 19, 2015
·
2 revisions
SimpleReact v0.3 introduces retry functionality.
To make a Stage retry-able, use the retry method. e.g.
new SimpleReact()
.<Integer> react(() -> url1, () -> url2, () -> url3)
.retry(it -> readRemoteService(it))
.then(it -> extractData(it))
.then(it -> writeToQueue(it))
If readRemoteService fails, it will be retried according to the rules of the configurable RetryExecutor Fine Tuning SimpleReact. The RetryExecutor is part of the async-retry project from Tomasz Nurkiewicz
The default RetryExecutor has the following settings
new AsyncRetryExecutor(Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors())).
retryOn(Throwable.class).
withExponentialBackoff(500, 2). //500ms times 2 after each retry
withMaxDelay(10_000). //10 seconds
withUniformJitter(). //add between +/- 100 ms randomly
withMaxRetries(20));
For more details on how to configure Retry see async-retry configuration options
oops - my bad