Interface SnsPublishProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, TaskStateBaseProps
All Known Implementing Classes:
SnsPublishProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-24T02:42:45.447Z") @Stability(Stable) public interface SnsPublishProps extends software.amazon.jsii.JsiiSerializable, TaskStateBaseProps
Properties for publishing a message to an SNS topic.

Example:

 EvaluateExpression convertToSeconds = EvaluateExpression.Builder.create(this, "Convert to seconds")
         .expression("$.waitMilliseconds / 1000")
         .resultPath("$.waitSeconds")
         .build();
 EvaluateExpression createMessage = EvaluateExpression.Builder.create(this, "Create message")
         // Note: this is a string inside a string.
         .expression("`Now waiting ${$.waitSeconds} seconds...`")
         .runtime(Runtime.NODEJS_LATEST)
         .resultPath("$.message")
         .build();
 SnsPublish publishMessage = SnsPublish.Builder.create(this, "Publish message")
         .topic(new Topic(this, "cool-topic"))
         .message(TaskInput.fromJsonPathAt("$.message"))
         .resultPath("$.sns")
         .build();
 Wait wait = Wait.Builder.create(this, "Wait")
         .time(WaitTime.secondsPath("$.waitSeconds"))
         .build();
 StateMachine.Builder.create(this, "StateMachine")
         .definition(convertToSeconds.next(createMessage).next(publishMessage).next(wait))
         .build();
 
  • Method Details

    • getMessage

      @Stability(Stable) @NotNull TaskInput getMessage()
      The message you want to send.

      With the exception of SMS, messages must be UTF-8 encoded strings and at most 256 KB in size. For SMS, each message can contain up to 140 characters.

    • getTopic

      @Stability(Stable) @NotNull ITopic getTopic()
      The SNS topic that the task will publish to.
    • getMessageAttributes

      @Stability(Stable) @Nullable default Map<String,MessageAttribute> getMessageAttributes()
      Add message attributes when publishing.

      These attributes carry additional metadata about the message and may be used for subscription filters.

      Default: {}

      See Also:
    • getMessageDeduplicationId

      @Stability(Stable) @Nullable default String getMessageDeduplicationId()
      This parameter applies only to FIFO topics.

      Every message must have a unique MessageDeduplicationId, which is a token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any message sent with the same MessageDeduplicationId during the 5-minute deduplication interval is treated as a duplicate.

      If the topic has ContentBasedDeduplication set, the system generates a MessageDeduplicationId based on the contents of the message. Your MessageDeduplicationId overrides the generated one.

      Default: - Not used for standard topics, required for FIFO topics with ContentBasedDeduplication disabled.

    • getMessageGroupId

      @Stability(Stable) @Nullable default String getMessageGroupId()
      This parameter applies only to FIFO topics.

      The MessageGroupId is a tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). Every message must include a MessageGroupId.

      Default: - Not used for standard topics, required for FIFO topics.

    • getMessagePerSubscriptionType

      @Stability(Stable) @Nullable default Boolean getMessagePerSubscriptionType()
      Send different messages for each transport protocol.

      For example, you might want to send a shorter message to SMS subscribers and a more verbose message to email and SQS subscribers.

      Your message must be a JSON object with a top-level JSON key of "default" with a value that is a string You can define other top-level keys that define the message you want to send to a specific transport protocol (i.e. "sqs", "email", "http", etc)

      Default: false

      See Also:
    • getSubject

      @Stability(Stable) @Nullable default String getSubject()
      Used as the "Subject" line when the message is delivered to email endpoints.

      This field will also be included, if present, in the standard JSON messages delivered to other endpoints.

      Default: - No subject

    • builder

      @Stability(Stable) static SnsPublishProps.Builder builder()
      Returns:
      a SnsPublishProps.Builder of SnsPublishProps