# BackoffFunction

Algorithms which can be used by SNS to calculate the delays associated with all of the retry attempts between the first and last retries in the backoff phase.

- Source: [`aws-sns/lib/delivery-policy.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-sns/lib/delivery-policy.ts#L6)
- Type last changed: v2.169.0 · 21 Nov 2024

## Example

```ts
const myTopic = new sns.Topic(this, 'MyTopic');

myTopic.addSubscription(
  new subscriptions.UrlSubscription(
    'https://foobar.com/',
    {
      deliveryPolicy: {
        healthyRetryPolicy: {
          minDelayTarget: Duration.seconds(5),
          maxDelayTarget: Duration.seconds(10),
          numRetries: 6,
          backoffFunction: sns.BackoffFunction.EXPONENTIAL,
        },
        throttlePolicy: {
          maxReceivesPerSecond: 10,
        },
        requestPolicy: {
          headerContentType: 'application/json',
        },
      },
    },
  ),
);
```

## Members

| Member | Description |
| --- | --- |
| `ARITHMETIC` | Arithmetic, see [this image](https://docs.aws.amazon.com/images/sns/latest/dg/images/backoff-graph.png) for how this function compares to others. |
| `EXPONENTIAL` | Exponential, see [this image](https://docs.aws.amazon.com/images/sns/latest/dg/images/backoff-graph.png) for how this function compares to others. |
| `GEOMETRIC` | Geometric, see [this image](https://docs.aws.amazon.com/images/sns/latest/dg/images/backoff-graph.png) for how this function compares to others. |
| `LINEAR` | Linear, see [this image](https://docs.aws.amazon.com/images/sns/latest/dg/images/backoff-graph.png) for how this function compares to others. |

## Referenced by

- [`HealthyRetryPolicy`](/v2/docs/aws-cdk-lib.aws_sns.HealthyRetryPolicy).backoffFunction
