Package com.rabbitmq.client.amqp
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
Modifier and TypeInterfaceDescriptionstatic final class
Policy with an initial delay for the first attempt, then a fixed delay, and a timeout.static final class
Policy with an initial delay for the first attempt, then a fixed delay. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondelay
(int recoveryAttempt) Returns the delay to use for a given attempt.static BackOffDelayPolicy
Policy with a fixed delay.static BackOffDelayPolicy
fixedWithInitialDelay
(Duration initialDelay, Duration delay) Policy with an initial delay for the first attempt, then a fixed delay.static BackOffDelayPolicy
fixedWithInitialDelay
(Duration initialDelay, Duration delay, Duration timeout) Policy with an initial delay for the first attempt, then a fixed delay, and a timeout.
-
Field Details
-
TIMEOUT
-
-
Method Details
-
delay
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
- number of the recovery attempt- Returns:
- the delay, TIMEOUT if the task should stop being retried
-
fixed
Policy with a fixed delay.- Parameters:
delay
- the fixed delay- Returns:
- fixed-delay policy
-
fixedWithInitialDelay
Policy with an initial delay for the first attempt, then a fixed delay.- Parameters:
initialDelay
- delay for the first attemptdelay
- delay for other attempts than the first one- Returns:
- fixed-delay policy with initial delay
-
fixedWithInitialDelay
static BackOffDelayPolicy fixedWithInitialDelay(Duration initialDelay, Duration delay, Duration timeout) Policy with an initial delay for the first attempt, then a fixed delay, and a timeout.- Parameters:
initialDelay
- delay for the first attemptdelay
- delay for other attempts than the first onetimeout
- timeout- Returns:
- fixed-delay policy with initial delay and timeout
-