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.
Contains the details of a single Amazon SQS message along with an Id
.
Namespace: Amazon.SQS.Model
Assembly: AWSSDK.SQS.dll
Version: 3.x.y.z
public class SendMessageBatchRequestEntry
The SendMessageBatchRequestEntry type exposes the following members
Name | Description | |
---|---|---|
![]() |
SendMessageBatchRequestEntry() |
Empty constructor used to set properties independently even when a simple constructor is available |
![]() |
SendMessageBatchRequestEntry(string, string) |
Instantiates SendMessageBatchRequestEntry with the parameterized properties |
Name | Type | Description | |
---|---|---|---|
![]() |
DelaySeconds | System.Int32 |
Gets and sets the property DelaySeconds.
The length of time, in seconds, for which a specific message is delayed. Valid values:
0 to 900. Maximum: 15 minutes. Messages with a positive
When you set |
![]() |
Id | System.String |
Gets and sets the property Id. An identifier for a message in this batch used to communicate the result.
The This identifier can have up to 80 characters. The following characters are accepted: alphanumeric characters, hyphens(-), and underscores (_). |
![]() |
MessageAttributes | System.Collections.Generic.Dictionary<System.String, Amazon.SQS.Model.MessageAttributeValue> |
Gets and sets the property MessageAttributes.
Each message attribute consists of a |
![]() |
MessageBody | System.String |
Gets and sets the property MessageBody. The body of the message. |
![]() |
MessageDeduplicationId | System.String |
Gets and sets the property MessageDeduplicationId. This parameter applies only to FIFO (first-in-first-out) queues.
The token used for deduplication of messages within a 5-minute minimum deduplication
interval. If a message with a particular
The
If a message is sent successfully but the acknowledgement is lost and the message
is resent with the same Amazon SQS continues to keep track of the message deduplication ID even after the message is received and deleted.
The length of
For best practices of using |
![]() |
MessageGroupId | System.String |
Gets and sets the property MessageGroupId. This parameter applies only to FIFO (first-in-first-out) queues.
The 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). To interleave multiple
ordered streams within a single queue, use
The length of
For best practices of using
|
![]() |
MessageSystemAttributes | System.Collections.Generic.Dictionary<System.String, Amazon.SQS.Model.MessageSystemAttributeValue> |
Gets and sets the property MessageSystemAttributes.
The message system attribute to send Each message system attribute consists of a
|
This example shows how to send messages in batch.
var client = new AmazonSQSClient(); var entry1 = new SendMessageBatchRequestEntry { DelaySeconds = 0, Id = "Entry1", 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." }; var entry2 = new SendMessageBatchRequestEntry { DelaySeconds = 0, Id = "Entry2", MessageAttributes = new Dictionary<string, MessageAttributeValue> { { "MyNameAttribute", new MessageAttributeValue { DataType = "String", StringValue = "Jane Doe" } }, { "MyAddressAttribute", new MessageAttributeValue { DataType = "String", StringValue = "456 Center Road" } }, { "MyRegionAttribute", new MessageAttributeValue { DataType = "String", StringValue = "Any City, United States" } } }, MessageBody = "Jane Doe customer information." }; var entry3 = new SendMessageBatchRequestEntry { DelaySeconds = 0, Id = "Entry3", MessageAttributes = new Dictionary<string, MessageAttributeValue> { { "MyNameAttribute", new MessageAttributeValue { DataType = "String", StringValue = "Richard Doe" } }, { "MyAddressAttribute", new MessageAttributeValue { DataType = "String", StringValue = "789 East Blvd." } }, { "MyRegionAttribute", new MessageAttributeValue { DataType = "String", StringValue = "Anywhere, United States" } } }, MessageBody = "Richard Doe customer information." }; var request = new SendMessageBatchRequest { Entries = new List<SendMessageBatchRequestEntry>() { entry1, entry2, entry3 }, QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue" }; var response = client.SendMessageBatch(request); if (response.Successful.Count > 0) { Console.WriteLine("Successfully sent:"); foreach (var success in response.Successful) { Console.WriteLine(" For ID: '" + success.Id + "':"); Console.WriteLine(" Message ID = " + success.MessageId); Console.WriteLine(" MD5 of message attributes = " + success.MD5OfMessageAttributes); Console.WriteLine(" MD5 of message body = " + success.MD5OfMessageBody); } } if (response.Failed.Count > 0) { Console.WriteLine("Failed to be sent:"); foreach (var fail in response.Failed) { Console.WriteLine(" For ID '" + fail.Id + "':"); Console.WriteLine(" Code = " + fail.Code); Console.WriteLine(" Message = " + fail.Message); Console.WriteLine(" Sender's fault? = " + fail.SenderFault); } }
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5