ox.resilience
Members list
Type members
Classlikes
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors).
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors).
Type parameters
- E
-
The error type of the operation. For operations returning a
T
or aTry[T]
, this is fixed toThrowable
. For operations returning anEither[E, T]
, this can be anyE
. - T
-
The successful result type for the operation.
Value parameters
- isSuccess
-
A function that determines whether a non-erroneous result is considered successful. By default, every non-erroneous result is considered successful.
- isWorthRetrying
-
A function that determines whether an error is worth retrying. By default, all errors are retried.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ResultPolicy.type
A config that defines how to retry a failed operation.
A config that defines how to retry a failed operation.
It is a special case of ScheduledConfig with ScheduledConfig.sleepMode always set to SleepMode.Delay
Type parameters
- E
-
The error type of the operation. For operations returning a
T
or aTry[T]
, this is fixed toThrowable
. For operations returning anEither[E, T]
, this can be anyE
. - T
-
The successful result type for the operation.
Value parameters
- onRetry
-
A function that is invoked after each retry attempt. The callback receives the number of the current retry attempt (starting from 1) and the result of the operation that was attempted. The result is either a successful value or an error. The callback can be used to log information about the retry attempts, or to perform other side effects. By default, the callback does nothing.
- resultPolicy
-
A policy that allows to customize when a non-erroneous result is considered successful and when an error is worth retrying (which allows for failing fast on certain errors). See ResultPolicy for more details.
- schedule
-
The retry schedule which determines the maximum number of retries and the delay between subsequent attempts to execute the operation. See Schedule for more details.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RetryConfig.type
Value members
Concrete methods
Retries an operation returning a direct result until it succeeds or the config decides to stop.
Retries an operation returning a direct result until it succeeds or the config decides to stop.
retry is a special case of scheduled with a given set of defaults. See RetryConfig for more details.
Value parameters
- config
-
The retry config - see RetryConfig.
- operation
-
The operation to retry.
Attributes
- Returns
-
The result of the function if it eventually succeeds.
- Throws
-
anything
The exception thrown by the last attempt if the config decides to stop.
- See also
-
scheduled
Retries an operation returning an scala.util.Either until it succeeds or the config decides to stop. Note that any exceptions thrown by the operation aren't caught and don't cause a retry to happen.
Retries an operation returning an scala.util.Either until it succeeds or the config decides to stop. Note that any exceptions thrown by the operation aren't caught and don't cause a retry to happen.
retryEither is a special case of scheduledEither with a given set of defaults. See RetryConfig for more details.
Value parameters
- config
-
The retry config - see RetryConfig.
- operation
-
The operation to retry.
Attributes
- Returns
-
A scala.util.Right if the function eventually succeeds, or, otherwise, a scala.util.Left with the error from the last attempt.
- See also
-
scheduledEither
Retries an operation using the given error mode until it succeeds or the config decides to stop. Note that any exceptions thrown by the operation aren't caught (unless the operation catches them as part of its implementation) and don't cause a retry to happen.
Retries an operation using the given error mode until it succeeds or the config decides to stop. Note that any exceptions thrown by the operation aren't caught (unless the operation catches them as part of its implementation) and don't cause a retry to happen.
retryWithErrorMode is a special case of scheduledWithErrorMode with a given set of defaults. See RetryConfig for more details.
Value parameters
- config
-
The retry config - see RetryConfig.
- em
-
The error mode to use, which specifies when a result value is considered success, and when a failure.
- operation
-
The operation to retry.
Attributes
- Returns
-
Either:
- the result of the function if it eventually succeeds, in the context of
F
, as dictated by the error mode. - the error
E
in contextF
as returned by the last attempt if the config decides to stop.
- the result of the function if it eventually succeeds, in the context of
- See also
-
scheduledWithErrorMode