Pipelink.Outbox
1.0.20
dotnet add package Pipelink.Outbox --version 1.0.20
NuGet\Install-Package Pipelink.Outbox -Version 1.0.20
<PackageReference Include="Pipelink.Outbox" Version="1.0.20" />
<PackageVersion Include="Pipelink.Outbox" Version="1.0.20" />
<PackageReference Include="Pipelink.Outbox" />
paket add Pipelink.Outbox --version 1.0.20
#r "nuget: Pipelink.Outbox, 1.0.20"
#:package Pipelink.Outbox@1.0.20
#addin nuget:?package=Pipelink.Outbox&version=1.0.20
#tool nuget:?package=Pipelink.Outbox&version=1.0.20
Pipelink.Outbox
A .NET library for implementing the outbox pattern with Entity Framework Core.
Overview
Pipelink.Outbox provides a simple and efficient way to implement the outbox pattern in your .NET applications using Entity Framework Core. The outbox pattern is a reliable way to handle message publishing in distributed systems, ensuring that messages are not lost even if the system fails.
Features
- Easy integration with Entity Framework Core
- Support for multiple message types
- Automatic message publishing through background service
- Configurable retry policies
- Transactional message handling
- Comprehensive test coverage
- Support for batch processing
- Detailed error tracking and logging
Installation
dotnet add package Pipelink.Outbox
Quick Start
- Configure your DbContext:
public class YourDbContext : DbContext
{
public DbSet<OutboxMessage> OutboxMessages { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfiguration(new OutboxMessageConfiguration());
}
}
- Use the outbox in your services:
public class YourService
{
private readonly YourDbContext _context;
private readonly IOutboxPublisher _publisher;
public YourService(YourDbContext context, IOutboxPublisher publisher)
{
_context = context;
_publisher = publisher;
}
public async Task ProcessOrder(Order order)
{
using var transaction = await _context.Database.BeginTransactionAsync();
// Save your business data
_context.Orders.Add(order);
await _context.SaveChangesAsync();
// Add message to outbox
await _publisher.PublishAsync(order);
await transaction.CommitAsync();
}
}
- Configure the publisher and background service in your startup:
services.AddOutboxPublisher(options =>
{
options.RetryCount = 3;
options.RetryInterval = TimeSpan.FromSeconds(5);
options.BatchSize = 100;
});
// Add the background service
services.AddHostedService<OutboxPublisherBackgroundService>();
Configuration Options
RetryCount
: Number of retry attempts for failed messages (default: 3)RetryInterval
: Time between retry attempts (default: 5 seconds)BatchSize
: Number of messages to process in a single batch (default: 100)
Message Processing
The library includes a background service that automatically processes messages in the outbox. Messages go through the following states:
- Pending: Initial state when a message is added to the outbox
- Processing: When the message is being processed
- Completed: When the message is successfully processed
- Failed: When the message failed after all retry attempts
Error Handling
The library provides robust error handling:
- Failed messages are automatically retried based on the configured retry count
- Each failure is logged with detailed error information
- Messages that exceed the retry count are marked as failed
- Error details are stored with the message for debugging
Testing
The library includes comprehensive tests covering:
- Message publishing
- Message processing
- Error handling
- Retry mechanisms
- Batch processing
- Background service operation
To run the tests:
dotnet test
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For support, please open an issue in the GitHub repository.
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 was computed. 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 was computed. 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. |
-
net8.0
- Microsoft.EntityFrameworkCore (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
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 | |
---|---|---|---|
1.0.20 | 159 | 4/22/2025 | |
1.0.19 | 240 | 4/22/2025 | |
1.0.18 | 238 | 4/22/2025 | |
1.0.17 | 261 | 4/22/2025 | |
1.0.16 | 248 | 4/22/2025 | |
1.0.15 | 255 | 4/22/2025 | |
1.0.14 | 272 | 4/22/2025 | |
1.0.13 | 257 | 4/22/2025 | |
1.0.12 | 258 | 4/22/2025 | |
1.0.11 | 265 | 4/22/2025 | |
1.0.10 | 260 | 4/22/2025 | |
1.0.9 | 262 | 4/22/2025 | |
1.0.7 | 265 | 4/22/2025 | |
1.0.6 | 255 | 4/22/2025 | |
1.0.5 | 269 | 4/22/2025 | |
1.0.4 | 258 | 4/22/2025 | |
1.0.3 | 258 | 4/22/2025 | |
1.0.2 | 260 | 4/22/2025 | |
1.0.1 | 260 | 4/22/2025 | |
1.0.0 | 265 | 4/22/2025 |