ZeroAlloc.Outbox.InMemory
1.0.1
See the version list below for details.
dotnet add package ZeroAlloc.Outbox.InMemory --version 1.0.1
NuGet\Install-Package ZeroAlloc.Outbox.InMemory -Version 1.0.1
<PackageReference Include="ZeroAlloc.Outbox.InMemory" Version="1.0.1" />
<PackageVersion Include="ZeroAlloc.Outbox.InMemory" Version="1.0.1" />
<PackageReference Include="ZeroAlloc.Outbox.InMemory" />
paket add ZeroAlloc.Outbox.InMemory --version 1.0.1
#r "nuget: ZeroAlloc.Outbox.InMemory, 1.0.1"
#:package ZeroAlloc.Outbox.InMemory@1.0.1
#addin nuget:?package=ZeroAlloc.Outbox.InMemory&version=1.0.1
#tool nuget:?package=ZeroAlloc.Outbox.InMemory&version=1.0.1
ZeroAlloc.Outbox
Source-generated transactional outbox for .NET. Annotate a message type with [OutboxMessage] and a Roslyn source generator emits a typed writer and dispatcher bridge — no reflection, no boxing, AOT-safe. Backed by EF Core (production) or in-memory (tests), with a built-in polling worker, exponential-backoff retry, and dead-letter support.
Install
# Core abstractions + source generator (always required)
dotnet add package ZeroAlloc.Outbox
dotnet add package ZeroAlloc.Outbox.Generator
# Pick a store:
dotnet add package ZeroAlloc.Outbox.EfCore # production — Entity Framework Core
dotnet add package ZeroAlloc.Outbox.InMemory # testing — in-process, no database
Quick start
1. Annotate your message:
using ZeroAlloc.Outbox;
[OutboxMessage]
public sealed record OrderPlaced(int OrderId, decimal Amount);
The generator emits IOutboxWriter<OrderPlaced> and its DI registration extension.
2. Register with DI:
builder.Services.AddOutbox(options =>
{
options.PollingInterval = TimeSpan.FromSeconds(5);
options.BatchSize = 50;
options.MaxAttempts = 3;
});
builder.Services.AddOutboxEfCore<AppDbContext>(); // or AddOutboxInMemory()
builder.Services.AddOrderPlacedOutbox(); // generated extension
3. Write in a transaction:
public class OrderService(IOutboxWriter<OrderPlaced> writer, AppDbContext db)
{
public async Task PlaceOrderAsync(Order order, CancellationToken ct)
{
db.Orders.Add(order);
await db.SaveChangesAsync(ct);
await writer.WriteAsync(new OrderPlaced(order.Id, order.Total), ct: ct);
}
}
For atomic writes (both or neither commit), pass the
DbTransactionexplicitly. See EF Core Transaction.
4. Implement a dispatcher:
public class OrderPlacedDispatcher(IMessageBus bus) : IOutboxDispatcher<OrderPlaced>
{
public async Task DispatchAsync(OrderPlaced message, CancellationToken ct)
=> await bus.PublishAsync(message, ct);
}
// Register the dispatcher
builder.Services.AddTransient<IOutboxDispatcher<OrderPlaced>, OrderPlacedDispatcher>();
Features
| Feature | Notes |
|---|---|
| Source-generated writers | [OutboxMessage] triggers generator; typed IOutboxWriter<T> emitted at compile time |
| Typed dispatchers | IOutboxDispatcher<T> — implement once, wire to any transport (bus, HTTP, email) |
| EF Core store | Writes and reads via DbContext; enlist in ambient transaction for atomicity |
| InMemory store | Thread-safe in-process store for unit and integration tests |
| Polling worker | OutboxWorkerService (IHostedService) polls on configurable interval with scope isolation |
| Exponential backoff | Retry delay = RetryBaseDelay × 2^(attempt-1); configurable via OutboxOptions |
| Dead-letter | Entries that exceed MaxAttempts are dead-lettered with the failure reason |
| AOT / trimmer safe | All dispatch code is generated; no Type.GetType, no MakeGenericType |
IOptions<OutboxOptions> |
Full options support with hot-reload via standard Microsoft.Extensions.Options |
Diagnostics
| ID | Severity | Description |
|---|---|---|
| ZO0001 | Warning | [OutboxMessage] applied to an interface — code will not be generated |
| ZO0002 | Warning | [OutboxMessage] applied to a static class — code will not be generated |
| ZO0003 | Warning | [OutboxMessage] applied to a nested type — use a top-level type for a stable type discriminator |
Documentation
Full docs live in docs/:
- Getting Started
- Outbox Pattern
- Message Types
- Dispatchers
- Store Adapters
- Background Worker
- Dependency Injection
- Diagnostics: ZO0001 · ZO0002 · ZO0003
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- ZeroAlloc.Outbox (>= 1.0.1)
-
net8.0
- ZeroAlloc.Outbox (>= 1.0.1)
-
net9.0
- ZeroAlloc.Outbox (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.5.0 | 56 | 5/14/2026 |
| 2.4.1 | 90 | 5/12/2026 |
| 2.4.0 | 96 | 5/4/2026 |
| 2.3.1 | 96 | 5/3/2026 |
| 2.3.0 | 87 | 5/1/2026 |
| 2.2.1 | 94 | 4/28/2026 |
| 2.2.0 | 90 | 4/28/2026 |
| 2.1.1 | 93 | 4/28/2026 |
| 2.1.0 | 94 | 4/26/2026 |
| 2.0.0 | 96 | 4/25/2026 |
| 1.3.0 | 97 | 4/25/2026 |
| 1.2.2 | 99 | 4/25/2026 |
| 1.2.1 | 97 | 4/24/2026 |
| 1.2.0 | 96 | 4/24/2026 |
| 1.1.2 | 97 | 4/23/2026 |
| 1.1.1 | 94 | 4/23/2026 |
| 1.1.0 | 91 | 4/22/2026 |
| 1.0.1 | 89 | 4/22/2026 |
| 1.0.0 | 103 | 4/20/2026 |
| 0.1.0 | 99 | 4/20/2026 |