Skip to content

feat: Outbox management API — dead-letter inspection, replay, and statistics (IOutboxManagement)#158

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-outbox-management-api
Draft

feat: Outbox management API — dead-letter inspection, replay, and statistics (IOutboxManagement)#158
Copilot wants to merge 2 commits intomainfrom
copilot/add-outbox-management-api

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

Operators had no programmatic way to inspect dead-letter messages, review failure reasons, or replay them — direct database access was the only option.

New contracts (NetEvolve.Pulse.Extensibility)

  • IOutboxManagement — management interface:
    • GetDeadLetterMessagesAsync(pageSize, page) — paginated dead-letter listing, ordered by UpdatedAt DESC
    • GetDeadLetterMessageAsync(messageId) — single message lookup
    • GetDeadLetterCountAsync() — dead-letter count
    • ReplayMessageAsync(messageId) — reset one dead-letter to Pending, clears RetryCount/Error; returns bool
    • ReplayAllDeadLetterAsync() — reset all dead-letters to Pending; returns affected count
    • GetStatisticsAsync() — returns OutboxStatistics (counts per OutboxMessageStatus)
  • OutboxStatistics — read-only snapshot with Pending, Processing, Completed, Failed, DeadLetter, computed Total

EF Core (NetEvolve.Pulse.EntityFramework)

  • EntityFrameworkOutboxManagement<TContext> — LINQ/ExecuteUpdateAsync-based implementation
  • Registered as IOutboxManagement (Scoped) via AddEntityFrameworkOutbox<TContext>()

SQL Server (NetEvolve.Pulse.SqlServer)

  • SqlServerOutboxManagement — ADO.NET implementation backed by six new stored procedures added to OutboxMessage.sql:
    usp_GetDeadLetterOutboxMessages, usp_GetDeadLetterOutboxMessage, usp_GetDeadLetterOutboxMessageCount, usp_ReplayOutboxMessage, usp_ReplayAllDeadLetterOutboxMessages, usp_GetOutboxStatistics
  • Registered as IOutboxManagement (Scoped) in both AddSqlServerOutbox overloads

Usage

// Inject IOutboxManagement and use it to inspect/replay dead-letters
var deadLetters = await management.GetDeadLetterMessagesAsync(pageSize: 20, page: 0);
var replayed = await management.ReplayAllDeadLetterAsync();
var stats = await management.GetStatisticsAsync();
// stats.DeadLetter, stats.Pending, stats.Total, …

Note for SQL Server users: re-run Scripts/OutboxMessage.sql to create the six new stored procedures before deploying.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add IOutboxManagement API for dead-letter inspection and replay feat: Outbox management API — dead-letter inspection, replay, and statistics (IOutboxManagement) Mar 28, 2026
Copilot AI requested a review from samtrion March 28, 2026 10:03
/// <para><strong>Thread Safety:</strong></para>
/// Implementations SHOULD be thread-safe for concurrent administrative access.
/// </remarks>
public interface IOutboxManagement
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a method which returns the number of dead letter messages. @copilot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDeadLetterCountAsync() is already included in the interface (line 47) and is implemented in both EntityFrameworkOutboxManagement and SqlServerOutboxManagement — no changes needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Outbox management API — dead-letter inspection, replay, and statistics (IOutboxManagement)

2 participants