Class SnsPublishProps
Properties for publishing a message to an SNS topic.
Inheritance
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.AWS.StepFunctions.Tasks.dll
Syntax (csharp)
public class SnsPublishProps : Object, ISnsPublishProps, ITaskStateBaseProps
Syntax (vb)
Public Class SnsPublishProps
Inherits Object
Implements ISnsPublishProps, ITaskStateBaseProps
Remarks
ExampleMetadata: infused
Examples
var convertToSeconds = new EvaluateExpression(this, "Convert to seconds", new EvaluateExpressionProps {
Expression = "$.waitMilliseconds / 1000",
ResultPath = "$.waitSeconds"
});
var createMessage = new EvaluateExpression(this, "Create message", new EvaluateExpressionProps {
// Note: this is a string inside a string.
Expression = "`Now waiting ${$.waitSeconds} seconds...`",
Runtime = Runtime.NODEJS_14_X,
ResultPath = "$.message"
});
var publishMessage = new SnsPublish(this, "Publish message", new SnsPublishProps {
Topic = new Topic(this, "cool-topic"),
Message = TaskInput.FromJsonPathAt("$.message"),
ResultPath = "$.sns"
});
var wait = new Wait(this, "Wait", new WaitProps {
Time = WaitTime.SecondsPath("$.waitSeconds")
});
new StateMachine(this, "StateMachine", new StateMachineProps {
Definition = convertToSeconds.Next(createMessage).Next(publishMessage).Next(wait)
});
Synopsis
Constructors
SnsPublishProps() |
Properties
Comment | An optional description for this state. |
Heartbeat | Timeout for the heartbeat. |
InputPath | JSONPath expression to select part of the state to be the input to this state. |
IntegrationPattern | AWS Step Functions integrates with services directly in the Amazon States Language. |
Message | The message you want to send. |
MessageAttributes | Add message attributes when publishing. |
MessagePerSubscriptionType | Send different messages for each transport protocol. |
OutputPath | JSONPath expression to select select a portion of the state output to pass to the next state. |
ResultPath | JSONPath expression to indicate where to inject the state's output. |
ResultSelector | The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. |
Subject | Used as the "Subject" line when the message is delivered to email endpoints. |
Timeout | Timeout for the state machine. |
Topic | The SNS topic that the task will publish to. |
Constructors
SnsPublishProps()
public SnsPublishProps()
Properties
Comment
An optional description for this state.
public string Comment { get; set; }
Property Value
System.String
Remarks
Default: - No comment
Heartbeat
Timeout for the heartbeat.
public Duration Heartbeat { get; set; }
Property Value
Remarks
Default: - None
InputPath
JSONPath expression to select part of the state to be the input to this state.
public string InputPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the effective input to be the empty object {}.
Default: - The entire task input (JSON path '$')
IntegrationPattern
AWS Step Functions integrates with services directly in the Amazon States Language.
public Nullable<IntegrationPattern> IntegrationPattern { get; set; }
Property Value
System.Nullable<IntegrationPattern>
Remarks
You can control these AWS services using service integration patterns
Default: - IntegrationPattern.REQUEST_RESPONSE
for most tasks.
IntegrationPattern.RUN_JOB
for the following exceptions:
BatchSubmitJob
, EmrAddStep
, EmrCreateCluster
, EmrTerminationCluster
, and EmrContainersStartJobRun
.
See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
Message
The message you want to send.
public TaskInput Message { get; set; }
Property Value
Remarks
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.
MessageAttributes
Add message attributes when publishing.
public IDictionary<string, IMessageAttribute> MessageAttributes { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, IMessageAttribute>
Remarks
These attributes carry additional metadata about the message and may be used for subscription filters.
Default: {}
See: https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html
MessagePerSubscriptionType
Send different messages for each transport protocol.
public Nullable<bool> MessagePerSubscriptionType { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
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: https://docs.aws.amazon.com/sns/latest/api/API_Publish.html#API_Publish_RequestParameters
OutputPath
JSONPath expression to select select a portion of the state output to pass to the next state.
public string OutputPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the effective output to be the empty object {}.
Default: - The entire JSON node determined by the state input, the task result, and resultPath is passed to the next state (JSON path '$')
ResultPath
JSONPath expression to indicate where to inject the state's output.
public string ResultPath { get; set; }
Property Value
System.String
Remarks
May also be the special value JsonPath.DISCARD, which will cause the state's input to become its output.
Default: - Replaces the entire input with the result (JSON path '$')
ResultSelector
The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
public IDictionary<string, object> ResultSelector { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Remarks
You can use ResultSelector to create a payload with values that are static or selected from the state's raw result.
Default: - None
Subject
Used as the "Subject" line when the message is delivered to email endpoints.
public string Subject { get; set; }
Property Value
System.String
Remarks
This field will also be included, if present, in the standard JSON messages delivered to other endpoints.
Default: - No subject
Timeout
Timeout for the state machine.
public Duration Timeout { get; set; }
Property Value
Remarks
Default: - None
Topic
The SNS topic that the task will publish to.
public ITopic Topic { get; set; }
Property Value