Package com.rabbitmq.stream
Interface BackOffDelayPolicy
-
- All Known Implementing Classes:
BackOffDelayPolicy.FixedWithInitialDelayAndTimeoutBackOffPolicy
,BackOffDelayPolicy.FixedWithInitialDelayBackOffPolicy
public interface BackOffDelayPolicy
Contract to determine a delay between attempts of some task.The task is typically the creation of a connection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BackOffDelayPolicy.FixedWithInitialDelayAndTimeoutBackOffPolicy
static class
BackOffDelayPolicy.FixedWithInitialDelayBackOffPolicy
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Duration
delay(int recoveryAttempt)
Returns the delay to use for a given attempt.static BackOffDelayPolicy
fixed(Duration delay)
A policy with a constant delay.static BackOffDelayPolicy
fixedWithInitialDelay(Duration initialDelay, Duration delay)
A policy with a first delay and then a constant delay.static BackOffDelayPolicy
fixedWithInitialDelay(Duration initialDelay, Duration delay, Duration timeout)
A policy with a first delay, then a constant delay until a timeout is reached.
-
-
-
Field Detail
-
TIMEOUT
static final Duration TIMEOUT
-
-
Method Detail
-
fixed
static BackOffDelayPolicy fixed(Duration delay)
A policy with a constant delay.- Parameters:
delay
-- Returns:
- the constant delay policy
-
fixedWithInitialDelay
static BackOffDelayPolicy fixedWithInitialDelay(Duration initialDelay, Duration delay)
A policy with a first delay and then a constant delay.- Parameters:
initialDelay
-delay
-- Returns:
- the policy with an initial delay
-
fixedWithInitialDelay
static BackOffDelayPolicy fixedWithInitialDelay(Duration initialDelay, Duration delay, Duration timeout)
A policy with a first delay, then a constant delay until a timeout is reached.- Parameters:
initialDelay
-delay
-timeout
-- Returns:
- the policy with an initial delay
-
delay
Duration delay(int recoveryAttempt)
Returns the delay to use for a given attempt.The policy can return the TIMEOUT constant to indicate that the task has reached a timeout.
- Parameters:
recoveryAttempt
-- Returns:
- the delay, TIMEOUT if the task should stop being retried
-
-