Package akka.pattern
Class RetrySettings
- java.lang.Object
-
- akka.pattern.RetrySettings
-
public final class RetrySettings extends java.lang.Object
Settings for retrying operations. param: maxRetries maximum number of retries param: delayFunction function to calculate the delay between retries param: shouldRetry function to determine if a failure should be retried
-
-
Constructor Summary
Constructors Constructor Description RetrySettings()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RetrySettings
apply(int maxRetries)
Scala API: Create settings with exponential backoff delay between retries.static RetrySettings
apply(com.typesafe.config.Config config)
Scala API: Create settings from configuration.static RetrySettings
create(int maxRetries)
Scala API: Create settings with exponential backoff delay between retries.static RetrySettings
create(com.typesafe.config.Config config)
Java API: Create settings from configuration.scala.Function1<java.lang.Object,scala.Option<scala.concurrent.duration.FiniteDuration>>
delayFunction()
int
maxRetries()
scala.Function1<java.lang.Throwable,java.lang.Object>
shouldRetry()
java.lang.String
toString()
RetrySettings
withDecider(scala.Function1<java.lang.Throwable,java.lang.Object> shouldRetry)
Scala API: Set the function to determine if a failure should be retried.RetrySettings
withDelayFunction(scala.Function1<java.lang.Object,scala.Option<scala.concurrent.duration.FiniteDuration>> delayFunction)
Scala API: Set custom delay function between retries.RetrySettings
withExponentialBackoff(java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor)
Java API: Set exponential backoff delay between retries.RetrySettings
withExponentialBackoff(scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Scala API: Set exponential backoff delay between retries.RetrySettings
withFixedDelay(java.time.Duration fixedDelay)
Java API: Set fixed delay between retries.RetrySettings
withFixedDelay(scala.concurrent.duration.FiniteDuration fixedDelay)
Scala API: Set fixed delay between retries.RetrySettings
withJavaDecider(java.util.function.Function<java.lang.Throwable,java.lang.Boolean> shouldRetry)
Java API: Set the function to determine if a failure should be retried.RetrySettings
withJavaDelayFunction(java.util.function.IntFunction<java.util.Optional<java.time.Duration>> delayFunction)
Java API: Set custom delay function between retries.
-
-
-
Method Detail
-
apply
public static RetrySettings apply(int maxRetries)
Scala API: Create settings with exponential backoff delay between retries. The exponential backoff settings are calculated based on number of retries.- Parameters:
maxRetries
- maximum number of retries- Returns:
- RetrySettings with exponential backoff delay
-
create
public static RetrySettings create(int maxRetries)
Scala API: Create settings with exponential backoff delay between retries. The exponential backoff settings are calculated based on number of retries.- Parameters:
maxRetries
- maximum number of retries- Returns:
- RetrySettings with exponential backoff delay
-
apply
public static RetrySettings apply(com.typesafe.config.Config config)
Scala API: Create settings from configuration.
-
create
public static RetrySettings create(com.typesafe.config.Config config)
Java API: Create settings from configuration.
-
maxRetries
public int maxRetries()
-
delayFunction
public scala.Function1<java.lang.Object,scala.Option<scala.concurrent.duration.FiniteDuration>> delayFunction()
-
shouldRetry
public scala.Function1<java.lang.Throwable,java.lang.Object> shouldRetry()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
withExponentialBackoff
public RetrySettings withExponentialBackoff(scala.concurrent.duration.FiniteDuration minBackoff, scala.concurrent.duration.FiniteDuration maxBackoff, double randomFactor)
Scala API: Set exponential backoff delay between retries.- Parameters:
minBackoff
- minimum backoff durationmaxBackoff
- maximum backoff durationrandomFactor
- random factor to add jitter to the backoff
-
withExponentialBackoff
public RetrySettings withExponentialBackoff(java.time.Duration minBackoff, java.time.Duration maxBackoff, double randomFactor)
Java API: Set exponential backoff delay between retries.- Parameters:
minBackoff
- minimum backoff durationmaxBackoff
- maximum backoff durationrandomFactor
- random factor to add jitter to the backoff- Returns:
- Updated settings
-
withFixedDelay
public RetrySettings withFixedDelay(scala.concurrent.duration.FiniteDuration fixedDelay)
Scala API: Set fixed delay between retries.- Parameters:
fixedDelay
- fixed delay between retries- Returns:
- Updated settings
-
withFixedDelay
public RetrySettings withFixedDelay(java.time.Duration fixedDelay)
Java API: Set fixed delay between retries.- Parameters:
fixedDelay
- fixed delay between retries- Returns:
- Updated settings
-
withDelayFunction
public RetrySettings withDelayFunction(scala.Function1<java.lang.Object,scala.Option<scala.concurrent.duration.FiniteDuration>> delayFunction)
Scala API: Set custom delay function between retries.- Parameters:
delayFunction
- function to calculate the delay between retries- Returns:
- Updated settings
-
withJavaDelayFunction
public RetrySettings withJavaDelayFunction(java.util.function.IntFunction<java.util.Optional<java.time.Duration>> delayFunction)
Java API: Set custom delay function between retries.- Parameters:
delayFunction
- function to calculate the delay between retries- Returns:
- Updated settings
-
withDecider
public RetrySettings withDecider(scala.Function1<java.lang.Throwable,java.lang.Object> shouldRetry)
Scala API: Set the function to determine if a failure should be retried.- Parameters:
shouldRetry
- function to determine if a failure should be retried- Returns:
- Updated settings
-
withJavaDecider
public RetrySettings withJavaDecider(java.util.function.Function<java.lang.Throwable,java.lang.Boolean> shouldRetry)
Java API: Set the function to determine if a failure should be retried.- Parameters:
shouldRetry
- function to determine if a failure should be retried- Returns:
- Updated settings
-
-