Enum 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 back to the queue.
    Since:
    21.05.2019
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ReenqueueRetryType valueOf​(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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • 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 to the 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:

         
         db-queue.queueName.reenqueue-retry-type=sequential
         db-queue.queueName.reenqueue-retry-plan=PT1S,PT10S,PT1M,P7D
         
        For the first attempt to defer the task a delay of 1 second will be chosen (PT1S), 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:

         
         db-queue.queueName.reenqueue-retry-type=fixed
         db-queue.queueName.reenqueue-retry-delay=PT10S
         
        Means that for each attempt the task will be deferred for 10 seconds.
      • ARITHMETIC

        public static final ReenqueueRetryType ARITHMETIC
        The task is deferred by the delay set using an arithmetic progression. The term of progression selected according to the 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:

         
         db-queue.queueName.reenqueue-retry-type=arithmetic
         db-queue.queueName.reenqueue-retry-initial-delay=PT1S
         db-queue.queueName.reenqueue-retry-step=PT2S
         
        Means that the task will be deferred with following delays: 1 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 to the 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:

         
         db-queue.queueName.reenqueue-retry-type=geometric
         db-queue.queueName.reenqueue-retry-initial-delay=PT1S
         db-queue.queueName.reenqueue-retry-ratio=2
         
        Means that the task will be deferred with following delays: 1 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 name
        java.lang.NullPointerException - if the argument is null