Interface IMessageAttribute
A message attribute to add to the SNS message.
Namespace: Amazon.CDK.AWS.StepFunctions.Tasks
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IMessageAttribute
Syntax (vb)
Public Interface IMessageAttribute
Remarks
See: https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html
ExampleMetadata: infused
Examples
var topic = new Topic(this, "Topic");
// Use a field from the execution data as message.
var task1 = new SnsPublish(this, "Publish1", new SnsPublishProps {
Topic = topic,
IntegrationPattern = IntegrationPattern.REQUEST_RESPONSE,
Message = TaskInput.FromDataAt("$.state.message"),
MessageAttributes = new Dictionary<string, MessageAttribute> {
{ "place", new MessageAttribute {
Value = JsonPath.StringAt("$.place")
} },
{ "pic", new MessageAttribute {
// BINARY must be explicitly set
DataType = MessageAttributeDataType.BINARY,
Value = JsonPath.StringAt("$.pic")
} },
{ "people", new MessageAttribute {
Value = 4
} },
{ "handles", new MessageAttribute {
Value = new [] { "@kslater", "@jjf", null, "@mfanning" }
} }
}
});
// Combine a field from the execution data with
// a literal object.
var task2 = new SnsPublish(this, "Publish2", new SnsPublishProps {
Topic = topic,
Message = TaskInput.FromObject(new Dictionary<string, object> {
{ "field1", "somedata" },
{ "field2", JsonPath.StringAt("$.field2") }
})
});
Synopsis
Properties
Data |
The data type for the attribute. |
Value | The value of the attribute. |
Properties
DataType
The data type for the attribute.
virtual Nullable<MessageAttributeDataType> DataType { get; }
Property Value
System.
Remarks
Default: determined by type inspection if possible, fallback is String
See: https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html#SNSMessageAttributes.DataTypes
Value
The value of the attribute.
object Value { get; }
Property Value
System.