![]() |
VOOZH | about |
dotnet add package Yautbox --version 1.2.1
NuGet\Install-Package Yautbox -Version 1.2.1
<PackageReference Include="Yautbox" Version="1.2.1" />
<PackageVersion Include="Yautbox" Version="1.2.1" />Directory.Packages.props
<PackageReference Include="Yautbox" />Project file
paket add Yautbox --version 1.2.1
#r "nuget: Yautbox, 1.2.1"
#:package Yautbox@1.2.1
#addin nuget:?package=Yautbox&version=1.2.1Install as a Cake Addin
#tool nuget:?package=Yautbox&version=1.2.1Install as a Cake Tool
Yautbox is a lightweight .NET outbox library. It lets you enqueue messages during application work and process them later with background handlers. The core package is storage-agnostic; choose the in-memory or PostgreSQL provider, or implement your own.
IOutboxProviderNuGet:
dotnet add package Yautbox
From source:
dotnet add <your-app>.csproj reference src/Yautbox/Yautbox.csproj
using Microsoft.Extensions.DependencyInjection;
using Yautbox.Extensions.Ioc;
using Yautbox.InMemory.Extensions; // from Yautbox.InMemory package
services.AddOutbox(builder => builder.UseInMemory());
using Yautbox.Extensions.Ioc;
using Yautbox.Handlers;
services.AddOutboxHandler<OrderPlaced, OrderPlacedHandler>();
public sealed class OrderPlacedHandler : IOutboxHandler<OrderPlaced>
{
public Task HandleAsync(IEnumerable<OutboxMessage<OrderPlaced>> messages, CancellationToken ct)
{
foreach (var message in messages)
{
// process message.Payload
// message.Retry(TimeSpan.FromMinutes(1)); // optional retry
}
return Task.CompletedTask;
}
}
using Yautbox.Services;
await outbox.HandleAsync(new[] { new OrderPlaced("A-123") });
await outbox.HandleAsync(
new[] { new OrderPlaced("B-456") },
scheduledAt: DateTimeOffset.UtcNow.AddMinutes(5));
Cancel by id if needed:
using Yautbox.Extensions.Outbox;
await outbox.CancelAsync<OrderPlaced>(messageId);
Each handler can be configured via AddOutboxHandler().ConfigureOptions<TOptions>(). Implement IOutboxRunnerOptions for full control or ISimpleRunnerOptions when only BufferSize must be supplied.
using Microsoft.Extensions.Options;
using Yautbox.Extensions.Ioc;
using Yautbox.Runner.Options;
services
.AddOutboxHandler<OrderPlaced, OrderPlacedHandler>()
.ConfigureOptions<DefaultRunnerOptions>(options =>
options.Configure(o =>
{
o.BufferSize = 500;
o.WorkersCount = 2;
o.ExecutionPolicy = ExecutionPolicy.Parallel;
o.BackupInterval = TimeSpan.FromHours(24);
}));
IOutboxRunnerOptions settings and defaults:
Identifier (default: payload type assembly-qualified name without version, culture, or public key token)PollDelay (default: 5s + jitter)BufferSize (default: 1000)PerBufferCount (default: BufferSize)HandleTimeout (default: 55m)IsEnabled (default: true)WorkersCount (default: 1)DeletePolicy (default: Safe)FailureDelay (default: 2s + jitter)Visibility (default: 1h)BackupInterval (default: null, disabled)CleanupInterval (default: 1d)ExecutionPolicy (default: Parallel)CancellationPolicy (default: Safe)PolicyTimeout (default: 55m)ScopeLifetime (default: PerBatch)IOutboxService enqueues messages into an IOutboxProvider.AddOutboxHandler<TPayload, THandler>() registers two hosted services:
BackupInterval is setExecutionPolicy.Sequential uses a provider-level policy scope to ensure single active processing for the same identifier when the provider supports distributed locking.To create a custom storage implementation, implement IOutboxProvider and register it via AddOutbox(builder => builder.SetProvider<...>()).
Yautbox reports lifecycle metrics through IMetricsHandler. The default handler is a no-op. Register a custom handler via the infrastructure builder:
using Yautbox.Extensions.Ioc;
using Yautbox.Metrics;
services.AddOutbox(builder =>
{
builder.UseInMemory();
builder.SetMetrics<MyMetricsHandler>();
});
public sealed class MyMetricsHandler : IMetricsHandler
{
public ValueTask AddedAsync(string identifier, int count, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask CanceledAsync(string identifier, int count, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask HandledAsync(string identifier, int count, TimeSpan elapsed, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask RetriedAsync(string identifier, int count, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask DeletedAsync(string identifier, int count, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask CleanedInAsync(string identifier, TimeSpan elapsed, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask ReadInAsync(string identifier, TimeSpan elapsed, CancellationToken ct) => ValueTask.CompletedTask;
public ValueTask ErrorsAsync(string identifier, int count, CancellationToken ct) => ValueTask.CompletedTask;
}
net8.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 4 NuGet packages that depend on Yautbox:
| Package | Downloads |
|---|---|
|
Yautbox.Postgres
PostgreSQL provider for Yautbox with schema migrations and advisory locks for sequential execution. |
|
|
Yautbox.InMemory
In-memory Yautbox provider using a bounded in-process queue. Ideal for tests and local development where durability is not required. |
|
|
Yautbox.Mssql
SQL Server provider for Yautbox with schema migrations and distributed locks for sequential execution. |
|
|
Yautbox.Mysql
MySQL provider for Yautbox with schema migrations and distributed locks for sequential execution. |
This package is not used by any popular GitHub repositories.