HoneyDrunk.Data.Outbox
0.7.0
dotnet add package HoneyDrunk.Data.Outbox --version 0.7.0
NuGet\Install-Package HoneyDrunk.Data.Outbox -Version 0.7.0
<PackageReference Include="HoneyDrunk.Data.Outbox" Version="0.7.0" />
<PackageVersion Include="HoneyDrunk.Data.Outbox" Version="0.7.0" />
<PackageReference Include="HoneyDrunk.Data.Outbox" />
paket add HoneyDrunk.Data.Outbox --version 0.7.0
#r "nuget: HoneyDrunk.Data.Outbox, 0.7.0"
#:package HoneyDrunk.Data.Outbox@0.7.0
#addin nuget:?package=HoneyDrunk.Data.Outbox&version=0.7.0
#tool nuget:?package=HoneyDrunk.Data.Outbox&version=0.7.0
HoneyDrunk.Data.Outbox
EF Core persistence implementation for the HoneyDrunk.Data transactional outbox.
What's Inside
| Type | Purpose |
|---|---|
EfOutboxWriter<TContext> |
Adds outbox messages to the change tracker for atomic commit |
EfOutboxReader<TContext> |
Lease-based batch retrieval with compare-and-swap concurrency and expired-lease recovery |
OutboxMessageConfiguration |
EF entity type configuration (table, indexes, concurrency token, LeasedUntil, LastError) |
ModelBuilderExtensions |
ApplyOutboxConfiguration() extension for ModelBuilder |
OutboxHeaderSerializer |
System.Text.Json serialization for the headers dictionary |
Design Constraints
- No bus references — does not know about Transport, Service Bus, or any broker.
- Only persist, fetch, update — never publishes messages.
- Concurrency-safe —
Statusis an EF concurrency token; per-message CAS prevents double-dispatch. - Lease recovery — messages with expired leases are automatically reclaimed by the next poll cycle.
Setup
1. Apply Entity Configuration
public class AppDbContext : HoneyDrunkDbContext
{
protected override void ApplyConfigurations(ModelBuilder modelBuilder)
{
modelBuilder.ApplyOutboxConfiguration(); // schema: "outbox", table: "OutboxMessages"
}
}
2. Register Services
services
.AddHoneyDrunkData()
.AddHoneyDrunkDataEntityFramework<AppDbContext>(...)
.AddHoneyDrunkDataOutbox<AppDbContext>();
3. Add Migration
dotnet ef migrations add AddOutbox --context AppDbContext
Context Enrichment
When OutboxOptions.AutoPopulateFromContext is enabled, EfOutboxWriter<TContext> requires a current Kernel IOperationContext and writes both CorrelationId and TenantId onto each message. If no operation context is available, callers must provide explicit non-empty CorrelationId and TenantId values on the message; otherwise the writer fails fast instead of persisting partial Grid context.
Concurrency Strategy
ClaimBatchAsync uses an atomic per-message ExecuteUpdateAsync with
a WHERE Status = Pending (or Status = Leased AND LeasedUntil <= UtcNow)
guard. The Status column is configured as an EF concurrency token, so only
one instance can claim each message. Instances that lose the race silently
skip the message.
For higher throughput on SQL Server, replace with a provider-specific reader
using READPAST + UPDLOCK table hints.
State Machine
Pending ── ClaimBatchAsync ──▶ Leased ── MarkDispatchedAsync ──▶ Dispatched
│
├── ReleaseForRetryAsync ──▶ Pending (retry)
└── DeadLetterAsync ──▶ DeadLetter
│
(lease expires) ──▶ reclaimed by next ClaimBatchAsync
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- HoneyDrunk.Data.Outbox.Abstractions (>= 0.7.0)
- HoneyDrunk.Kernel.Abstractions (>= 0.8.0)
- Microsoft.EntityFrameworkCore (>= 10.0.8)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HoneyDrunk.Data.Outbox:
| Package | Downloads |
|---|---|
|
HoneyDrunk.Data.Outbox.Dispatcher
Background dispatcher for the HoneyDrunk.Data transactional outbox. Polls pending messages and publishes them through HoneyDrunk.Transport abstractions with lease-based concurrency, configurable retry, and exponential backoff. Adapter-agnostic — references no specific message bus. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v0.7.0: ADR-0011 D11 Sonar cleanup — IUnitOfWork<TContext> exposes ContextType DIM, CorrelationCommandInterceptor switches to a strict allow-list sanitizer, EF naming convention refactored under cognitive-complexity limit. Bumps Kernel 0.7.0→0.8.0, Vault* 0.5.0→0.7.0, Transport 0.6.0→0.7.1, Microsoft.EntityFrameworkCore* and Microsoft.Extensions.* 10.0.7→10.0.8.