Class Subscription

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.sns.Subscription
All Implemented Interfaces:
IEnvironmentAware, IResource, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.133.0 (build 0f43e37)", date="2026-07-02T13:32:48.009Z") @Stability(Stable) public class Subscription extends Resource
A new subscription.

Prefer to use the ITopic.addSubscription() methods to create instances of this class.

Example:

 // producerStack defines an SNS topic
 Topic topic;
 // consumerStack subscribes to it with a weak reference,
 // so the producer can be torn down without blocking on this consumer
 Stack consumerStack = Stack.Builder.create(app, "Consumer")
         .env(Environment.builder().account("123456789012").region("us-east-1").build())
         .build();
 Subscription.Builder.create(consumerStack, "Subscription")
         .topic(Topic.fromTopicArn(consumerStack, "Topic", Stack.consumeReference(topic.getTopicArn())))
         .endpoint("https://example.com/webhook")
         .protocol(SubscriptionProtocol.HTTPS)
         .build();
 
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • Subscription

      protected Subscription(software.amazon.jsii.JsiiObjectRef objRef)
    • Subscription

      protected Subscription(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Subscription

      @Stability(Stable) public Subscription(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SubscriptionProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • getDeadLetterQueue

      @Stability(Stable) @Nullable public IQueue getDeadLetterQueue()
      The DLQ associated with this subscription if present.