The retry event handler
Operations can time out or fail because of broken connections, network glitches, unavailability of upstream services. Client applications deal with these failures by implementing retries. The retry is a very simple pattern where failed requests are retried a configurable number of times in case of a failure before the operation is marked as a failure.
You can provide a custom global RetryConfig. In order to create a custom
global RetryConfig, you can use the RetryConfig builder.
| Parameter | Default value | Description |
|---|---|---|
type |
retry |
The configuration property type |
name |
GW_RETRY |
The name of the retry instance that is used for logging purposes |
maxAttempts |
3 | The maximum number of retry attempts |
backoff |
Configures custom backoff algorithm for handling retries of
failed network calls. |
|
|
The type is random or exponential.
|
|
|
500 ms | The base backoff period that is set in milliseconds. |
|
1.5 | The multiplier is an arbitrary multiplier that can be replaced
with any suitable value for backoff period. The value is in Double
format. |
|
0.5 | The randomization factor. The value is in Double format. |
retryOnExceptionPredicateClass |
throwable -> true |
Configures a Predicate that evaluates if an exception has to be
retried. The Predicate must return true, if the exception has to be
retried, otherwise it must return false. To invoke retry when specified exceptions
occurred |
retryOnResultPredicateClass |
result -> false |
Configures a Predicate that evaluates if a result has to be
retried. The Predicate must return true, if the result has to be
retried, otherwise it must return false. Used to invoke retry when the specified
results are received. |
intervalFunctionClass |
numOfAttempts -> waitDuration |
A class that extends IntervalFunction. This functional is used
to modify the waiting interval after a failure. By default the wait duration remains
constant. |
See also:
