Class OutboxMessage<TPayload>
- Namespace
- PatternKit.Messaging.Reliability
- Assembly
- PatternKit.Core.dll
In-process outbox record that can be persisted by application code before dispatch.
public sealed class OutboxMessage<TPayload>
Type Parameters
TPayloadThe payload type stored in the outbox record.
- Inheritance
-
OutboxMessage<TPayload>
- Inherited Members
Constructors
OutboxMessage(string, Message<TPayload>, DateTimeOffset)
Creates an outbox record.
public OutboxMessage(string id, Message<TPayload> message, DateTimeOffset createdAt)
Parameters
idstringmessageMessage<TPayload>createdAtDateTimeOffset
Properties
Attempts
The number of dispatch attempts.
public int Attempts { get; }
Property Value
CreatedAt
When the outbox record was created.
public DateTimeOffset CreatedAt { get; }
Property Value
Dispatched
Gets whether the outbox record has been dispatched.
public bool Dispatched { get; }
Property Value
DispatchedAt
When the outbox record was dispatched, if it has been dispatched.
public DateTimeOffset? DispatchedAt { get; }
Property Value
Id
The outbox record identifier.
public string Id { get; }
Property Value
LastError
The last dispatch error, when available.
public string? LastError { get; }
Property Value
Message
The message to dispatch.
public Message<TPayload> Message { get; }
Property Value
- Message<TPayload>
Methods
MarkDispatched(DateTimeOffset)
Returns a copy marked as dispatched.
public OutboxMessage<TPayload> MarkDispatched(DateTimeOffset dispatchedAt)
Parameters
dispatchedAtDateTimeOffset
Returns
- OutboxMessage<TPayload>
WithAttempt(string?)
Returns a copy with dispatch attempt metadata recorded.
public OutboxMessage<TPayload> WithAttempt(string? error)
Parameters
errorstring
Returns
- OutboxMessage<TPayload>