Skip to content
v2.278.0

BackoffFunction Enum ​

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.

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',
        },
      },
    },
  ),
);
python
my_topic = sns.Topic(self, "MyTopic")

my_topic.add_subscription(
    subscriptions.UrlSubscription("https://foobar.com/",
        delivery_policy=sns.DeliveryPolicy(
            healthy_retry_policy=sns.HealthyRetryPolicy(
                min_delay_target=Duration.seconds(5),
                max_delay_target=Duration.seconds(10),
                num_retries=6,
                backoff_function=sns.BackoffFunction.EXPONENTIAL
            ),
            throttle_policy=sns.ThrottlePolicy(
                max_receives_per_second=10
            ),
            request_policy=sns.RequestPolicy(
                header_content_type="application/json"
            )
        )
    ))
java
Topic myTopic = new Topic(this, "MyTopic");

myTopic.addSubscription(
UrlSubscription.Builder.create("https://foobar.com/")
        .deliveryPolicy(DeliveryPolicy.builder()
                .healthyRetryPolicy(HealthyRetryPolicy.builder()
                        .minDelayTarget(Duration.seconds(5))
                        .maxDelayTarget(Duration.seconds(10))
                        .numRetries(6)
                        .backoffFunction(BackoffFunction.EXPONENTIAL)
                        .build())
                .throttlePolicy(ThrottlePolicy.builder()
                        .maxReceivesPerSecond(10)
                        .build())
                .requestPolicy(RequestPolicy.builder()
                        .headerContentType("application/json")
                        .build())
                .build())
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var myTopic = new Topic(this, "MyTopic");

myTopic.AddSubscription(
new UrlSubscription("https://foobar.com/", new UrlSubscriptionProps {
    DeliveryPolicy = new DeliveryPolicy {
        HealthyRetryPolicy = new HealthyRetryPolicy {
            MinDelayTarget = Duration.Seconds(5),
            MaxDelayTarget = Duration.Seconds(10),
            NumRetries = 6,
            BackoffFunction = BackoffFunction.EXPONENTIAL
        },
        ThrottlePolicy = new ThrottlePolicy {
            MaxReceivesPerSecond = 10
        },
        RequestPolicy = new RequestPolicy {
            HeaderContentType = "application/json"
        }
    }
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
myTopic := sns.NewTopic(this, jsii.String("MyTopic"))

myTopic.AddSubscription(
subscriptions.NewUrlSubscription(jsii.String("https://foobar.com/"), &UrlSubscriptionProps{
	DeliveryPolicy: &DeliveryPolicy{
		HealthyRetryPolicy: &HealthyRetryPolicy{
			MinDelayTarget: awscdk.Duration_Seconds(jsii.Number(5)),
			MaxDelayTarget: awscdk.Duration_*Seconds(jsii.Number(10)),
			NumRetries: jsii.Number(6),
			BackoffFunction: sns.BackoffFunction_EXPONENTIAL,
		},
		ThrottlePolicy: &ThrottlePolicy{
			MaxReceivesPerSecond: jsii.Number(10),
		},
		RequestPolicy: &RequestPolicy{
			HeaderContentType: jsii.String("application/json"),
		},
	},
}))

Members ​

MemberDescription
ARITHMETICArithmetic, see this image for how this function compares to others.
EXPONENTIALExponential, see this image for how this function compares to others.
GEOMETRICGeometric, see this image for how this function compares to others.
LINEARLinear, see this image for how this function compares to others.

Referenced by ​

  • HealthyRetryPolicy.backoffFunctionbackoff_functionbackoffFunctionBackoffFunctionBackoffFunction