Skip to content
11 changes: 11 additions & 0 deletions .autover/changes/45a6ab22-5bb9-4b65-bfb1-94571b502622.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "AWS.Messaging",
"Type": "Patch",
"ChangelogMessages": [
"Add SentTimestamp to SQSMetadata"
]
}
]
}
5 changes: 5 additions & 0 deletions src/AWS.Messaging/SQSMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class SQSMetadata
/// </summary>
public string? MessageGroupId { get; set; }

/// <summary>
/// The time at which the message was sent to the queue.
/// </summary>
public DateTimeOffset? SentTimestamp { get; set; }

/// <summary>
/// Each message attribute consists of a Name, Type, and Value.For more information, see Amazon SQS message attributes (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes)
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public static SQSMetadata CreateSQSMetadata(Message message)
{
metadata.MessageGroupId = JsonPropertyHelper.GetAttributeValue(message.Attributes, "MessageGroupId");
metadata.MessageDeduplicationId = JsonPropertyHelper.GetAttributeValue(message.Attributes, "MessageDeduplicationId");

var sentTimestamp = JsonPropertyHelper.GetAttributeValue(message.Attributes, "SentTimestamp");
if (!string.IsNullOrEmpty(sentTimestamp) && long.TryParse(sentTimestamp, out var epochMilliseconds))
{
metadata.SentTimestamp = DateTimeOffset.FromUnixTimeMilliseconds(epochMilliseconds);
}
}

return metadata;
Expand Down
Loading