Skip to content
v2.274.0

RetryProps Struct ​

Retry details.

Example ​

ts
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 ​

backoffRatenumberbackoff_rateint | floatbackoffRateNumberBackoffRatedoubleBackoffRate*float64= 2#
Multiplication for how much longer the wait interval gets on every retry.
errorsstring[]errorstyping.List[str]errorsList<String>Errorsstring[]Errors*[]*string#
Errors to retry.

Default: All errors

A list of error strings to retry, which can be either predefined errors (for example Errors.NoChoiceMatched) or a self-defined error.

intervalDurationintervalDurationintervalDurationIntervalDurationIntervalDuration= Duration.seconds(1)#
How many seconds to wait initially before retrying.
jitterStrategyJitterTypejitter_strategyJitterTypejitterStrategyJitterTypeJitterStrategyJitterTypeJitterStrategyJitterType#
Introduces a randomization over the retry interval.

Default: No jitter strategy

maxAttemptsnumbermax_attemptsint | floatmaxAttemptsNumberMaxAttemptsdoubleMaxAttempts*float64= 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).

maxDelayDurationmax_delayDurationmaxDelayDurationMaxDelayDurationMaxDelayDuration#
Maximum limit on retry interval growth during exponential backoff.

Default: No max delay