in core/src/main/scala/org/apache/pekko/projection/HandlerRecoveryStrategy.scala [52:92]
def retryAndFail(retries: Int, delay: FiniteDuration): HandlerRecoveryStrategy =
if (retries < 1) fail else RetryAndFail(retries, delay)
/**
* Java API: If the first attempt to invoke the handler fails it will retry invoking the handler with the
* same envelope this number of `retries` with the `delay` between each attempt. It will give up
* and fail the stream if all attempts fail.
*/
def retryAndFail(retries: Int, delay: java.time.Duration): HandlerRecoveryStrategy =
retryAndFail(retries, delay.asScala)
/**
* Scala API: If the first attempt to invoke the handler fails it will retry invoking the handler with the
* same envelope this number of `retries` with the `delay` between each attempt. It will give up,
* discard the element and continue with next if all attempts fail.
*/
def retryAndSkip(retries: Int, delay: FiniteDuration): HandlerRecoveryStrategy =
if (retries < 1) fail else RetryAndSkip(retries, delay)
/**
* Java API: If the first attempt to invoke the handler fails it will retry invoking the handler with the
* same envelope this number of `retries` with the `delay` between each attempt. It will give up,
* discard the element and continue with next if all attempts fail.
*/
def retryAndSkip(retries: Int, delay: java.time.Duration): HandlerRecoveryStrategy =
retryAndSkip(retries, delay.asScala)
/**
* INTERNAL API: placed here instead of the `internal` package because of sealed trait
*/
@InternalApi private[projection] object Internal {
case object Fail extends StrictRecoveryStrategy with RetryRecoveryStrategy
case object Skip extends StrictRecoveryStrategy with RetryRecoveryStrategy
final case class RetryAndFail(retries: Int, delay: FiniteDuration) extends RetryRecoveryStrategy {
require(retries > 0, "retries must be > 0")
}
final case class RetryAndSkip(retries: Int, delay: FiniteDuration) extends RetryRecoveryStrategy {
require(retries > 0, "retries must be > 0")
}
}