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 ​

backoffRateoptionalnumberbackoff_rateoptionalint | floatbackoffRateoptionalNumberBackoffRateoptionaldoubleBackoffRateoptional*float64= 2#
Multiplication for how much longer the wait interval gets on every retry.
errorsoptionalstring[]errorsoptionaltyping.List[str]errorsoptionalList<String>Errorsoptionalstring[]Errorsoptional*[]*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.

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

Default: No jitter strategy

maxAttemptsoptionalnumbermax_attemptsoptionalint | floatmaxAttemptsoptionalNumberMaxAttemptsoptionaldoubleMaxAttemptsoptional*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).

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

Default: No max delay