Closed
Description
Overview
After experimenting with our newly introduced core retry support (RetryPolicy
, RetryTemplate
, etc.) and @Retryable
support, it has become apparent that there are overlapping concerns between the current RetryPolicy
and BackOff
contracts.
RetryPolicy
andBackOff
both have stateful executions:RetryExecution
andBackOffExecution
. However, only one stateful execution is necessary.FixedBackOff
andExponentialBackOff
already incorporate "retry" logic in terms of max attempts, max elapsed time, etc. Thus, there is no need to duplicate such behavior in aRetryPolicy
and itsRetryExecution
.RetryTemplate
currently accepts both aRetryPolicy
and aBackOff
in order to instrument the retry algorithm. However, users would probably rather focus on configuring all "retry" logic via a single mechanism.
Deliverables
In light of the above, we have decided to directly incorporate BackOff
in RetryPolicy
. To achieve that, we will do the following.
- Remove the
RetryExecution
interface and move itsshouldRetry()
method toRetryPolicy
, replacing the currentRetryExecution start()
method. - Introduce a
default
getBackOff()
method in theRetryPolicy
interface. - Completely overhaul the
RetryPolicy.Builder
to provide support for configuring aBackOff
strategy. - Remove
BackOff
configuration fromRetryTemplate
.