Class RetryAfterException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.superdurable.dex.exceptions.RetryAfterException
All Implemented Interfaces:
Serializable

public final class RetryAfterException extends RuntimeException
Requests a specific delay before retrying a failed Step method.

Throw the value returned by after(Duration, Throwable) from wait-for or execute. On Temporal, the delay overrides only the next retry interval; retry limits and timeouts remain unchanged, and the current attempt failure remains the reported Worker error. Cadence rejects dynamic retry intervals with a Flow validation error.

throw RetryAfterException.after(Duration.ofSeconds(30), currentFailure);
See Also:
  • Method Details

    • after

      public static RetryAfterException after(Duration retryAfter, Throwable currentCause)
      Creates a retry request while preserving the current attempt failure.
      Parameters:
      retryAfter - the positive whole-second delay before the next attempt
      currentCause - the current Step method attempt failure reported to Dex
      Returns:
      an exception to throw from the Step method
      Throws:
      IllegalArgumentException - if the delay is null, nonpositive, fractional, or exceeds the signed 32-bit seconds range, or if the current cause is null
    • getRetryAfter

      public Duration getRetryAfter()
      Returns the requested delay before the next retry.
      Returns:
      the positive whole-second retry delay