Class RetryDecision
-
Method Summary
Modifier and TypeMethodDescriptiondelay()static RetryDecisionfail()Creates a retry decision indicating the operation should not be retried.static RetryDecisionCreates a retry decision indicating the operation should be retried after the specified delay.static RetryDecisionCreates a retry decision that also pauses the durable execution after the failed attempt.booleanReturns whether the execution pauses after this failed attempt.booleantoString()
-
Method Details
-
retry
Creates a retry decision indicating the operation should be retried after the specified delay.- Parameters:
delay- the duration to wait before retrying- Returns:
- a RetryDecision indicating retry with the specified delay
-
retry
Creates a retry decision that also pauses the durable execution after the failed attempt.The step saves its RETRY checkpoint, asks Lambda to pause the execution, and ends the invocation. After a
ResumeDurableExecutioncall, the step runs its next attempt. Pausing never changes the number of attempts.Only a step pauses. The submitter step of
waitForCallbackpauses too.withRetryignores the pause and waits as usual.The invocation waits for steps that are still running in other parallel or map branches. Their code can keep running, but the SDK does not save a result produced after the pause. After the resume, an at-least-once step runs again, and an at-most-once step counts the attempt as interrupted.
The function's execution role needs
lambda:PauseDurableExecutionon the function's durable execution ARNs, andkms:Decryptwhen a customer managed key protects the execution. If the pause call fails, the SDK logs a warning and the step retries as usual.- Parameters:
delay- the duration to wait before retrying after the execution is resumedpause- whether to pause the execution after this failed attempt- Returns:
- a RetryDecision indicating retry with the specified delay and pause choice
-
fail
Creates a retry decision indicating the operation should not be retried.- Returns:
- a RetryDecision indicating no retry should be attempted
-
shouldRetry
public boolean shouldRetry()- Returns:
- true if the operation should be retried, false otherwise
-
delay
- Returns:
- the duration to wait before retrying, or Duration.ZERO if no retry
-
shouldPause
Returns whether the execution pauses after this failed attempt.Only meaningful when
shouldRetry()is true.- Returns:
- true if the step pauses the execution after it saves the RETRY checkpoint
-
toString
-