Enum ReenqueueRetryType
- java.lang.Object
-
- java.lang.Enum<ReenqueueRetryType>
-
- ru.yoomoney.tech.dbqueue.settings.ReenqueueRetryType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ReenqueueRetryType>
public enum ReenqueueRetryType extends java.lang.Enum<ReenqueueRetryType>
Type of the strategy, which computes the delay before the next task execution if the task has to be brought backto the queue.- Since:
- 21.05.2019
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ARITHMETICThe task is deferred by the delay set using an arithmetic progression.FIXEDThe task is deferred by the fixed delay, which is set in configuration.GEOMETRICThe task is deferred by the delay set using a geometric progression The term of progression selected according tothe number of attempt to postpone the task processing.MANUALThe task is deferred by the delay set manually with methodTaskExecutionResult.reenqueue(Duration)call.SEQUENTIALThe task is deferred by the delay set with the sequence of delays.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ReenqueueRetryTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ReenqueueRetryType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MANUAL
public static final ReenqueueRetryType MANUAL
The task is deferred by the delay set manually with methodTaskExecutionResult.reenqueue(Duration)call.Default value for the task postponing strategy.
Settings example:
db-queue.queueName.reenqueue-retry-type=manual
-
SEQUENTIAL
public static final ReenqueueRetryType SEQUENTIAL
The task is deferred by the delay set with the sequence of delays. Delay is selected from the sequence according tothe number of task processing attempt. If the attempt number is bigger than the index of the last item in the sequence, then the last item will be used.For example, let the following sequence is set out in the settings:
For the first attempt to defer the task a delay of 1 second will be chosen (db-queue.queueName.reenqueue-retry-type=sequential db-queue.queueName.reenqueue-retry-plan=PT1S,PT10S,PT1M,P7DPT1S), for the second one it will be 10 seconds and so forth. For the fifth attempt and all the next after the delay will be 7 days.
-
FIXED
public static final ReenqueueRetryType FIXED
The task is deferred by the fixed delay, which is set in configuration.Settings example:
Means that for each attempt the task will be deferred for 10 seconds.db-queue.queueName.reenqueue-retry-type=fixed db-queue.queueName.reenqueue-retry-delay=PT10S
-
ARITHMETIC
public static final ReenqueueRetryType ARITHMETIC
The task is deferred by the delay set using an arithmetic progression. The term of progression selected according tothe number of attempt to postpone the task processing.The progression is set by a pair of values: the initial term (
reenqueue-retry-initial-delay) and the difference (reenqueue-retry-step).Settings example:
Means that the task will be deferred with following delays:db-queue.queueName.reenqueue-retry-type=arithmetic db-queue.queueName.reenqueue-retry-initial-delay=PT1S db-queue.queueName.reenqueue-retry-step=PT2S1 second, 3 seconds, 5 seconds, 7 seconds, ...
-
GEOMETRIC
public static final ReenqueueRetryType GEOMETRIC
The task is deferred by the delay set using a geometric progression The term of progression selected according tothe number of attempt to postpone the task processing.The progression is set by a pair of values: the initial term and the integer denominator.
Settings example:
Means that the task will be deferred with following delays:db-queue.queueName.reenqueue-retry-type=geometric db-queue.queueName.reenqueue-retry-initial-delay=PT1S db-queue.queueName.reenqueue-retry-ratio=21 second, 2 seconds, 4 seconds, 8 seconds, ...
-
-
Method Detail
-
values
public static ReenqueueRetryType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ReenqueueRetryType c : ReenqueueRetryType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ReenqueueRetryType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-