Enum Class RetryBehavior

java.lang.Object
java.lang.Enum<RetryBehavior>
com.tnsai.idempotency.RetryBehavior
All Implemented Interfaces:
Serializable, Comparable<RetryBehavior>, Constable

public enum RetryBehavior extends Enum<RetryBehavior>
What the framework does when a retry hits a previously-stored idempotency entry (issue #91).
Since:
0.5.0 (issue #91)
  • Enum Constant Details

    • RETURN_CACHED

      public static final RetryBehavior RETURN_CACHED
      Return the cached result; skip re-execution. Default for most tools — exactly the side-effect-deduplication semantic the feature exists for.
    • RETURN_CACHED_IF_SUCCESS

      public static final RetryBehavior RETURN_CACHED_IF_SUCCESS
      Return the cached result only if the original attempt succeeded. If the cached entry is a failure, skip the cache and let the tool re-run. Useful when the original failure was transient and the consumer prefers another shot over a permanently-cached error.
    • FAIL_FAST

      public static final RetryBehavior FAIL_FAST
      A retry hitting the cache is a hard error — throw IdempotencyException. Use when the caller wants to be told "this call already happened" rather than silently get the prior result (e.g. financial reconciliation tools where double-attempts are themselves a signal of upstream confusion).
  • Method Details

    • values

      public static RetryBehavior[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RetryBehavior valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null