interface RetryProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.StepFunctions.RetryProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#RetryProps |
Java | software.amazon.awscdk.services.stepfunctions.RetryProps |
Python | aws_cdk.aws_stepfunctions.RetryProps |
TypeScript (source) | aws-cdk-lib » aws_stepfunctions » RetryProps |
Retry details.
Example
const parallel = new sfn.Parallel(this, 'Do the work in parallel');
// Add branches to be executed in parallel
const shipItem = new sfn.Pass(this, 'ShipItem');
const sendInvoice = new sfn.Pass(this, 'SendInvoice');
const restock = new sfn.Pass(this, 'Restock');
parallel.branch(shipItem);
parallel.branch(sendInvoice);
parallel.branch(restock);
// Retry the whole workflow if something goes wrong with exponential backoff
parallel.addRetry({
maxAttempts: 1,
maxDelay: Duration.seconds(5),
jitterStrategy: sfn.JitterType.FULL,
});
// How to recover from errors
const sendFailureNotification = new sfn.Pass(this, 'SendFailureNotification');
parallel.addCatch(sendFailureNotification);
// What to do in case everything succeeded
const closeOrder = new sfn.Pass(this, 'CloseOrder');
parallel.next(closeOrder);
Properties
Name | Type | Description |
---|---|---|
backoff | number | Multiplication for how much longer the wait interval gets on every retry. |
errors? | string[] | Errors to retry. |
interval? | Duration | How many seconds to wait initially before retrying. |
jitter | Jitter | Introduces a randomization over the retry interval. |
max | number | How many times to retry this particular error. |
max | Duration | Maximum limit on retry interval growth during exponential backoff. |
backoffRate?
Type:
number
(optional, default: 2)
Multiplication for how much longer the wait interval gets on every retry.
errors?
Type:
string[]
(optional, default: All errors)
Errors to retry.
A list of error strings to retry, which can be either predefined errors (for example Errors.NoChoiceMatched) or a self-defined error.
interval?
Type:
Duration
(optional, default: Duration.seconds(1))
How many seconds to wait initially before retrying.
jitterStrategy?
Type:
Jitter
(optional, default: No jitter strategy)
Introduces a randomization over the retry interval.
maxAttempts?
Type:
number
(optional, default: 3)
How many times to retry this particular error.
May be 0 to disable retry for specific errors (in case you have a catch-all retry policy).
maxDelay?
Type:
Duration
(optional, default: No max delay)
Maximum limit on retry interval growth during exponential backoff.