UrlSubscriptionProps

class aws_cdk.aws_sns_subscriptions.UrlSubscriptionProps(*, dead_letter_queue=None, filter_policy=None, filter_policy_with_message_body=None, delivery_policy=None, protocol=None, raw_message_delivery=None)

Bases: SubscriptionProps

Options for URL subscriptions.

Parameters:
  • dead_letter_queue (Optional[IQueue]) – Queue to be used as dead letter queue. If not passed no dead letter queue is enabled. Default: - No dead letter queue enabled.

  • filter_policy (Optional[Mapping[str, SubscriptionFilter]]) – The filter policy. Default: - all messages are delivered

  • filter_policy_with_message_body (Optional[Mapping[str, FilterOrPolicy]]) – The filter policy that is applied on the message body. To apply a filter policy to the message attributes, use filterPolicy. A maximum of one of filterPolicyWithMessageBody and filterPolicy may be used. Default: - all messages are delivered

  • delivery_policy (Union[DeliveryPolicy, Dict[str, Any], None]) – The delivery policy. Default: - if the initial delivery of the message fails, three retries with a delay between failed attempts set at 20 seconds

  • protocol (Optional[SubscriptionProtocol]) – The subscription’s protocol. Default: - Protocol is derived from url

  • raw_message_delivery (Optional[bool]) – The message to the queue is the same as it was sent to the topic. If false, the message will be wrapped in an SNS envelope. Default: false

ExampleMetadata:

infused

Example:

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

Attributes

dead_letter_queue

Queue to be used as dead letter queue.

If not passed no dead letter queue is enabled.

Default:
  • No dead letter queue enabled.

delivery_policy

The delivery policy.

Default:
  • if the initial delivery of the message fails, three retries with a delay between failed attempts set at 20 seconds

filter_policy

The filter policy.

Default:
  • all messages are delivered

filter_policy_with_message_body

The filter policy that is applied on the message body.

To apply a filter policy to the message attributes, use filterPolicy. A maximum of one of filterPolicyWithMessageBody and filterPolicy may be used.

Default:
  • all messages are delivered

protocol

The subscription’s protocol.

Default:
  • Protocol is derived from url

raw_message_delivery

The message to the queue is the same as it was sent to the topic.

If false, the message will be wrapped in an SNS envelope.

Default:

false