Table of Contents

Class GovernanceOutboxEntry

Namespace
AsiBackbone.Core.Outbox
Assembly
AsiBackbone.Core.dll

Represents a provider-neutral durable outbox entry for a governance emission envelope.

public sealed class GovernanceOutboxEntry
Inheritance
GovernanceOutboxEntry
Inherited Members

Remarks

Outbox entries are intended to be persisted before optional downstream provider delivery is attempted.

Properties

CreatedUtc

Gets the UTC timestamp when the outbox entry was created.

public DateTimeOffset CreatedUtc { get; }

Property Value

DateTimeOffset

DeadLetterReason

Gets the dead-letter reason, when the entry has reached a terminal dead-letter state.

public string? DeadLetterReason { get; }

Property Value

string

Envelope

Gets the provider-neutral governance emission envelope being persisted for delivery.

public GovernanceEmissionEnvelope Envelope { get; }

Property Value

GovernanceEmissionEnvelope

HasMetadata

Gets a value indicating whether metadata is present.

public bool HasMetadata { get; }

Property Value

bool

IsDeadLettered

Gets a value indicating whether this entry has reached a terminal dead-letter state.

public bool IsDeadLettered { get; }

Property Value

bool

IsDelivered

Gets a value indicating whether this entry was delivered successfully.

public bool IsDelivered { get; }

Property Value

bool

LastError

Gets the last provider-neutral emission error, when available.

public GovernanceEmissionError? LastError { get; }

Property Value

GovernanceEmissionError

MaxRetryCount

Gets the maximum retry count before the entry should transition to dead-lettered.

public int MaxRetryCount { get; }

Property Value

int

Metadata

Gets minimized provider-neutral outbox metadata.

public IReadOnlyDictionary<string, string> Metadata { get; }

Property Value

IReadOnlyDictionary<string, string>

NextRetryUtc

Gets the next UTC retry timestamp, when retry scheduling is active.

public DateTimeOffset? NextRetryUtc { get; }

Property Value

DateTimeOffset?

OutboxEntryId

Gets the stable outbox entry identifier.

public string OutboxEntryId { get; }

Property Value

string

ProviderName

Gets the provider name associated with the most recent attempt, when available.

public string? ProviderName { get; }

Property Value

string

ProviderRecordId

Gets the provider-side record identifier, when delivery returned one and it is safe to store.

public string? ProviderRecordId { get; }

Property Value

string

RetryCount

Gets the number of failed or deferred delivery attempts recorded for this entry.

public int RetryCount { get; }

Property Value

int

Status

Gets the current provider-neutral outbox status.

public GovernanceEmissionStatus Status { get; }

Property Value

GovernanceEmissionStatus

UpdatedUtc

Gets the UTC timestamp when the outbox entry was last updated.

public DateTimeOffset UpdatedUtc { get; }

Property Value

DateTimeOffset

Methods

Create(GovernanceEmissionEnvelope, string?, DateTimeOffset?, int, IReadOnlyDictionary<string, string>?)

Creates a pending durable governance outbox entry.

public static GovernanceOutboxEntry Create(GovernanceEmissionEnvelope envelope, string? outboxEntryId = null, DateTimeOffset? createdUtc = null, int maxRetryCount = 5, IReadOnlyDictionary<string, string>? metadata = null)

Parameters

envelope GovernanceEmissionEnvelope
outboxEntryId string
createdUtc DateTimeOffset?
maxRetryCount int
metadata IReadOnlyDictionary<string, string>

Returns

GovernanceOutboxEntry

IsRetryReady(DateTimeOffset)

Determines whether the entry is ready for retry at the supplied UTC timestamp.

public bool IsRetryReady(DateTimeOffset utcNow)

Parameters

utcNow DateTimeOffset

Returns

bool

MarkDeadLettered(GovernanceEmissionError, string?, DateTimeOffset?)

Returns a dead-lettered copy of this entry.

public GovernanceOutboxEntry MarkDeadLettered(GovernanceEmissionError governanceEmissionError, string? deadLetterReason = null, DateTimeOffset? updatedUtc = null)

Parameters

governanceEmissionError GovernanceEmissionError
deadLetterReason string
updatedUtc DateTimeOffset?

Returns

GovernanceOutboxEntry

MarkDeferred(GovernanceEmissionError?, DateTimeOffset?, DateTimeOffset?)

Returns a deferred copy of this entry.

public GovernanceOutboxEntry MarkDeferred(GovernanceEmissionError? governanceEmissionError = null, DateTimeOffset? nextRetryUtc = null, DateTimeOffset? updatedUtc = null)

Parameters

governanceEmissionError GovernanceEmissionError
nextRetryUtc DateTimeOffset?
updatedUtc DateTimeOffset?

Returns

GovernanceOutboxEntry

MarkDelivered(GovernanceEmissionResult, DateTimeOffset?)

Returns a delivered copy of this entry.

public GovernanceOutboxEntry MarkDelivered(GovernanceEmissionResult result, DateTimeOffset? updatedUtc = null)

Parameters

result GovernanceEmissionResult
updatedUtc DateTimeOffset?

Returns

GovernanceOutboxEntry

MarkFailed(GovernanceEmissionError, DateTimeOffset?, DateTimeOffset?)

Returns a failed or retryable-failure copy of this entry.

public GovernanceOutboxEntry MarkFailed(GovernanceEmissionError governanceEmissionError, DateTimeOffset? nextRetryUtc = null, DateTimeOffset? updatedUtc = null)

Parameters

governanceEmissionError GovernanceEmissionError
nextRetryUtc DateTimeOffset?
updatedUtc DateTimeOffset?

Returns

GovernanceOutboxEntry

Restore(GovernanceEmissionEnvelope, GovernanceEmissionStatus, string, DateTimeOffset, DateTimeOffset, int, int, DateTimeOffset?, GovernanceEmissionError?, string?, string?, string?, IReadOnlyDictionary<string, string>?)

Restores a durable outbox entry from provider-neutral storage.

public static GovernanceOutboxEntry Restore(GovernanceEmissionEnvelope envelope, GovernanceEmissionStatus status, string outboxEntryId, DateTimeOffset createdUtc, DateTimeOffset updatedUtc, int retryCount = 0, int maxRetryCount = 5, DateTimeOffset? nextRetryUtc = null, GovernanceEmissionError? lastError = null, string? providerName = null, string? providerRecordId = null, string? deadLetterReason = null, IReadOnlyDictionary<string, string>? metadata = null)

Parameters

envelope GovernanceEmissionEnvelope
status GovernanceEmissionStatus
outboxEntryId string
createdUtc DateTimeOffset
updatedUtc DateTimeOffset
retryCount int
maxRetryCount int
nextRetryUtc DateTimeOffset?
lastError GovernanceEmissionError
providerName string
providerRecordId string
deadLetterReason string
metadata IReadOnlyDictionary<string, string>

Returns

GovernanceOutboxEntry

Remarks

This factory exists for storage adapters. It does not perform provider emission and does not add any provider dependency to Core.