java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IResource, INotificationRuleTarget, ITopic, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:09.907Z") @Stability(Stable) public class Topic extends TopicBase
A new SNS topic.

Example:

 import software.amazon.awscdk.services.sns.*;
 Topic topic = new Topic(this, "MyTopic");
 TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
         .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
         .actions(List.of(
             SnsTopicAction.Builder.create(topic)
                     .messageFormat(SnsActionMessageFormat.JSON)
                     .build()))
         .build();
 
  • Constructor Details

    • Topic

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

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

      @Stability(Stable) public Topic(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable TopicProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • Topic

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

    • fromTopicArn

      @Stability(Stable) @NotNull public static ITopic fromTopicArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String topicArn)
      Import an existing SNS topic provided an ARN.

      Parameters:
      scope - The parent creating construct. This parameter is required.
      id - The construct's name. This parameter is required.
      topicArn - topic ARN (i.e. arn:aws:sns:us-east-2:444455556666:MyTopic). This parameter is required.
    • fromTopicAttributes

      @Stability(Stable) @NotNull public static ITopic fromTopicAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TopicAttributes attrs)
      Import an existing SNS topic provided a topic attributes.

      Parameters:
      scope - The parent creating construct. This parameter is required.
      id - The construct's name. This parameter is required.
      attrs - the attributes of the topic to import. This parameter is required.
    • addLoggingConfig

      @Stability(Stable) public void addLoggingConfig(@NotNull LoggingConfig config)
      Adds a delivery status logging configuration to the topic.

      Parameters:
      config - This parameter is required.
    • getAutoCreatePolicy

      @Stability(Stable) @NotNull protected Boolean getAutoCreatePolicy()
      Controls automatic creation of policy objects.

      Set by subclasses.

      Specified by:
      getAutoCreatePolicy in class TopicBase
    • getContentBasedDeduplication

      @Stability(Stable) @NotNull public Boolean getContentBasedDeduplication()
      Enables content-based deduplication for FIFO topics.
      Specified by:
      getContentBasedDeduplication in interface ITopic
      Specified by:
      getContentBasedDeduplication in class TopicBase
    • getFifo

      @Stability(Stable) @NotNull public Boolean getFifo()
      Whether this topic is an Amazon SNS FIFO queue.

      If false, this is a standard topic.

      Specified by:
      getFifo in interface ITopic
      Specified by:
      getFifo in class TopicBase
    • getTopicArn

      @Stability(Stable) @NotNull public String getTopicArn()
      The ARN of the topic.
      Specified by:
      getTopicArn in interface ITopic
      Specified by:
      getTopicArn in class TopicBase
    • getTopicName

      @Stability(Stable) @NotNull public String getTopicName()
      The name of the topic.
      Specified by:
      getTopicName in interface ITopic
      Specified by:
      getTopicName in class TopicBase