RetryProps

class aws_cdk.aws_stepfunctions.RetryProps(*, backoff_rate=None, errors=None, interval=None, jitter_strategy=None, max_attempts=None, max_delay=None)

Bases: object

Retry details.

Parameters:
  • backoff_rate (Union[int, float, None]) – Multiplication for how much longer the wait interval gets on every retry. Default: 2

  • errors (Optional[Sequence[str]]) – 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. Default: All errors

  • interval (Optional[Duration]) – How many seconds to wait initially before retrying. Default: Duration.seconds(1)

  • jitter_strategy (Optional[JitterType]) – Introduces a randomization over the retry interval. Default: - No jitter strategy

  • max_attempts (Union[int, float, None]) – 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). Default: 3

  • max_delay (Optional[Duration]) – Maximum limit on retry interval growth during exponential backoff. Default: - No max delay

ExampleMetadata:

infused

Example:

parallel = sfn.Parallel(self, "Do the work in parallel")

# Add branches to be executed in parallel
ship_item = sfn.Pass(self, "ShipItem")
send_invoice = sfn.Pass(self, "SendInvoice")
restock = sfn.Pass(self, "Restock")
parallel.branch(ship_item)
parallel.branch(send_invoice)
parallel.branch(restock)

# Retry the whole workflow if something goes wrong with exponential backoff
parallel.add_retry(
    max_attempts=1,
    max_delay=Duration.seconds(5),
    jitter_strategy=sfn.JitterType.FULL
)

# How to recover from errors
send_failure_notification = sfn.Pass(self, "SendFailureNotification")
parallel.add_catch(send_failure_notification)

# What to do in case everything succeeded
close_order = sfn.Pass(self, "CloseOrder")
parallel.next(close_order)

Attributes

backoff_rate

Multiplication for how much longer the wait interval gets on every retry.

Default:

2

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.

Default:

All errors

interval

How many seconds to wait initially before retrying.

Default:

Duration.seconds(1)

jitter_strategy

Introduces a randomization over the retry interval.

Default:
  • No jitter strategy

max_attempts

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).

Default:

3

max_delay

Maximum limit on retry interval growth during exponential backoff.

Default:
  • No max delay