Interface SnsPublishProps

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:48.209Z") @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_14_X)
         .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:
    • 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