AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Name, type, and value must not be empty or null. In addition, the message body should not be empty or null. All parts of the message attribute, including name, type, and value, are included in the message size restriction, which is currently 256 KB (262,144 bytes).
Namespace: Amazon.SQS.Model
Assembly: AWSSDK.dll
Version: (assembly version)
public class MessageAttributeValue : Object
The MessageAttributeValue type exposes the following members
Name | Description | |
---|---|---|
MessageAttributeValue() |
Name | Type | Description | |
---|---|---|---|
BinaryListValues | System.Collections.Generic.List<System.IO.MemoryStream> |
Gets and sets the property BinaryListValues.
Not implemented. Reserved for future use. |
|
BinaryValue | System.IO.MemoryStream |
Gets and sets the property BinaryValue.
Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images. |
|
DataType | System.String |
Gets and sets the property DataType.
Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types. |
|
StringListValues | System.Collections.Generic.List<System.String> |
Gets and sets the property StringListValues.
Not implemented. Reserved for future use. |
|
StringValue | System.String |
Gets and sets the property StringValue.
Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters. |
This example shows how to send a message.
var client = new AmazonSQSClient(); var request = new SendMessageRequest { DelaySeconds = (int)TimeSpan.FromSeconds(5).TotalSeconds, MessageAttributes = new Dictionary<string, MessageAttributeValue> { { "MyNameAttribute", new MessageAttributeValue { DataType = "String", StringValue = "John Doe" } }, { "MyAddressAttribute", new MessageAttributeValue { DataType = "String", StringValue = "123 Main St." } }, { "MyRegionAttribute", new MessageAttributeValue { DataType = "String", StringValue = "Any Town, United States" } } }, MessageBody = "John Doe customer information.", QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue" }; var response = client.SendMessage(request); Console.WriteLine("For message ID '" + response.MessageId + "':"); Console.WriteLine(" MD5 of message attributes: " + response.MD5OfMessageAttributes); Console.WriteLine(" MD5 of message body: " + response.MD5OfMessageBody);
.NET Framework:
Supported in: 4.5, 4.0, 3.5
.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8
.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8