Annotation Interface BackOff


Collects metadata for creating a BackOff instance as part of a RetryPolicy. Values can be provided as is or using a *String equivalent that supports more format, as well as expression evaluations.

The available attributes lead to the following:

Since:
4.0
Author:
Dave Syer, Gary Russell, Aftab Shaikh, Stephane Nicoll
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Default delay() in milliseconds.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    long
    Specify the base delay after the initial invocation.
    Specify the base delay after the initial invocation using a String format.
    long
    Specify a jitter value for the base retry attempt, randomly subtracted or added to the calculated delay, resulting in a value between delay - jitter and delay + jitter but never below the base delay or above the max delay.
    Specify a jitter value for the base retry attempt using a String format.
    long
    Specify the maximum delay for any retry attempt, limiting how far jitter and the multiplier can increase the delay.
    Specify the maximum delay for any retry attempt using a String format.
    double
    Specify a multiplier for a delay for the next retry attempt, applied to the previous delay, starting with the initial delay as well as to the applicable jitter for each attempt.
    Specify a multiplier for a delay for the next retry attempt using a String format.
    long
    Alias for delay().
  • Field Details

  • Element Details

    • value

      @AliasFor("delay") long value
      Alias for delay().

      Intended to be used when no other attributes are needed, for example: @BackOff(2000).

      Returns:
      the based delay in milliseconds (default1000L)
      Default:
      1000L
    • delay

      @AliasFor("value") long delay
      Specify the base delay after the initial invocation.

      If only a delay is specified, a FixedBackOff with that value as the interval is configured.

      If a multiplier is specified, this serves as the initial delay to multiply from.

      The default is 1000L milliseconds.

      Returns:
      the based delay in milliseconds (default1000L)
      Default:
      1000L
    • delayString

      String delayString
      Specify the base delay after the initial invocation using a String format. If this is specified, takes precedence over delay().

      The delay String can be in several formats:

      • a plain long — which is interpreted to represent a duration in milliseconds
      • any of the known DurationFormat.Style: the ISO8601 style or the SIMPLE style — using milliseconds as fallback if the string doesn't contain an explicit unit
      • Regular expressions, such as ${example.property} to use the example.property from the environment
      Returns:
      the based delay as a String value — for example a placeholder
      See Also:
      Default:
      ""
    • maxDelay

      long maxDelay
      Specify the maximum delay for any retry attempt, limiting how far jitter and the multiplier can increase the delay.

      Ignored if only delay() is set, otherwise an ExponentialBackOff with the given max delay or an unlimited delay if not set.

      Returns:
      the maximum delay
      Default:
      0L
    • maxDelayString

      String maxDelayString
      Specify the maximum delay for any retry attempt using a String format. If this is specified, takes precedence over maxDelay()..

      The max delay String can be in several formats:

      • a plain long — which is interpreted to represent a duration in milliseconds
      • any of the known DurationFormat.Style: the ISO8601 style or the SIMPLE style — using milliseconds as fallback if the string doesn't contain an explicit unit
      • Regular expressions, such as ${example.property} to use the example.property from the environment
      Returns:
      the max delay as a String value — for example a placeholder
      See Also:
      Default:
      ""
    • multiplier

      double multiplier
      Specify a multiplier for a delay for the next retry attempt, applied to the previous delay, starting with the initial delay as well as to the applicable jitter for each attempt.

      Ignored if only delay() is set, otherwise an ExponentialBackOff with the given multiplier or 1.0 if not set.

      Returns:
      the value to multiply the current interval by for each attempt
      Default:
      0.0
    • multiplierString

      String multiplierString
      Specify a multiplier for a delay for the next retry attempt using a String format. If this is specified, takes precedence over multiplier().

      The multiplier String can be in several formats:

      • a plain double
      • Regular expressions, such as ${example.property} to use the example.property from the environment
      Returns:
      the value to multiply the current interval by for each attempt — for example, a placeholder
      See Also:
      Default:
      ""
    • jitter

      long jitter
      Specify a jitter value for the base retry attempt, randomly subtracted or added to the calculated delay, resulting in a value between delay - jitter and delay + jitter but never below the base delay or above the max delay.

      If a multiplier is specified, it is applied to the jitter value as well.

      Ignored if only delay() is set, otherwise an ExponentialBackOff with the given jitter or no jitter if not set.

      Returns:
      the jitter value in milliseconds
      See Also:
      Default:
      0L
    • jitterString

      String jitterString
      Specify a jitter value for the base retry attempt using a String format. If this is specified, takes precedence over jitter().

      The jitter String can be in several formats:

      • a plain long — which is interpreted to represent a duration in milliseconds
      • any of the known DurationFormat.Style: the ISO8601 style or the SIMPLE style — using milliseconds as fallback if the string doesn't contain an explicit unit
      • Regular expressions, such as ${example.property} to use the example.property from the environment
      Returns:
      the jitter as a String value — for example, a placeholder
      See Also:
      Default:
      ""