Class SqsMessageEnvelope
AWS SQS-specific message wrapper that adapts SQS messages to the unified envelope pattern.
public sealed class SqsMessageEnvelope : IDisposable, IAsyncDisposable
- Inheritance
-
SqsMessageEnvelope
- Implements
- Inherited Members
- Extension Methods
Remarks
This class provides a thin adapter layer that preserves AWS-specific metadata while delegating to the unified MessageEnvelope for core functionality.
Constructors
SqsMessageEnvelope(Message?, IDispatchMessage?, IMessageContext, int, Func<CancellationToken, Task>?, Func<string?, CancellationToken, Task>?)
Initializes a new instance of the SqsMessageEnvelope class.
public SqsMessageEnvelope(Message? sqsMessage, IDispatchMessage? dispatchMessage, IMessageContext messageContext, int pollerId = 0, Func<CancellationToken, Task>? onAcknowledge = null, Func<string?, CancellationToken, Task>? onReject = null)
Parameters
sqsMessageMessagedispatchMessageIDispatchMessagemessageContextIMessageContextpollerIdintonAcknowledgeFunc<CancellationToken, Task>onRejectFunc<string, CancellationToken, Task>
Properties
ApproximateReceiveCount
Gets or sets the approximate receive count.
public int ApproximateReceiveCount { get; set; }
Property Value
- int
The approximate receive count.
Context
Gets the message context with all metadata.
public IMessageContext Context { get; }
Property Value
- IMessageContext
The message context with all metadata.
Envelope
Gets the unified message envelope.
public MessageEnvelope<IDispatchMessage> Envelope { get; }
Property Value
- MessageEnvelope<IDispatchMessage>
The unified message envelope.
FirstReceiveTimestamp
Gets or sets the first receive timestamp.
public DateTime? FirstReceiveTimestamp { get; set; }
Property Value
- DateTime?
The first receive timestamp.
Message
Gets the dispatch message.
public IDispatchMessage? Message { get; }
Property Value
- IDispatchMessage
The dispatch message.
MessageAttributes
Gets the message attributes from SQS.
public Dictionary<string, MessageAttributeValue>? MessageAttributes { get; }
Property Value
- Dictionary<string, MessageAttributeValue>
The message attributes from SQS.
MessageId
Gets the message ID.
public string? MessageId { get; }
Property Value
- string
The message ID.
PollerId
Gets or sets the ID of the long poller.
public int PollerId { get; set; }
Property Value
- int
The ID of the long poller.
ReceiptHandle
Gets the receipt handle for acknowledgment.
public string? ReceiptHandle { get; }
Property Value
- string
The receipt handle for acknowledgment.
ReceivedAt
Gets when the message was received.
public DateTime ReceivedAt { get; }
Property Value
- DateTime
When the message was received.
SentTimestamp
Gets the sent timestamp.
public DateTime SentTimestamp { get; }
Property Value
- DateTime
The sent timestamp.
SqsMessage
Gets the underlying AWS SQS message.
public Message SqsMessage { get; }
Property Value
- Message
The underlying AWS SQS message.
Methods
AcknowledgeAsync(CancellationToken)
Acknowledges the message.
public Task AcknowledgeAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
RejectAsync(CancellationToken, string?)
Rejects the message.
public Task RejectAsync(CancellationToken cancellationToken, string? reason = null)
Parameters
cancellationTokenCancellationTokenreasonstring