DotEventOutbox 1.0.4
See the version list below for details.
dotnet add package DotEventOutbox --version 1.0.4
NuGet\Install-Package DotEventOutbox -Version 1.0.4
<PackageReference Include="DotEventOutbox" Version="1.0.4" />
paket add DotEventOutbox --version 1.0.4
#r "nuget: DotEventOutbox, 1.0.4"
// Install DotEventOutbox as a Cake Addin
#addin nuget:?package=DotEventOutbox&version=1.0.4
// Install DotEventOutbox as a Cake Tool
#tool nuget:?package=DotEventOutbox&version=1.0.4
DotEventOutbox
Overview
DotEventOutbox is a .NET library designed to streamline the implementation of the outbox pattern with MediatR and Entity Framework. It ensures reliable, consistent, and idempotent processing of domain events.
Features
- MediatR and Entity Framework Integration: Seamless interaction for managing and dispatching domain events.
- Idempotent Processing: Ensures each event is processed only once, avoiding duplicate handling.
- Automated Outbox Message Management: Handles conversion and lifecycle of domain events as outbox messages.
- Dead Letter Queue: Manages failed messages for later analysis or reprocessing.
- Quartz Integration: Automates and schedules outbox message processing.
- Configurable Settings: Customizable behavior through
EventOutboxSettings
.
Installing DotEventOutbox
You should install DotEventOutbox with NuGet:
Install-Package DotEventOutbox
Or via the .NET Core command line interface:
dotnet add package DotEventOutbox
Either commands, from Package Manager Console or .NET Core CLI, will download and install DotEventOutbox and all required dependencies.
Using Contracts-Only Package
To reference only the contracts for DotEventOutbox, which includes:
IEvent
DomainEvent
IDomainEventEmitter
Add a package reference to DotEventOutbox.Contracts
This package is useful in scenarios where your DotEventOutbox contracts are in a separate assembly/project from handlers.
Registering with IServiceCollection
DotEventOutbox supports Microsoft.Extensions.DependencyInjection.Abstractions
directly. To register various DotEventOutbox services:
services.AddDotEventOutbox(configuration,
options => options.UseNpgsql(configuration.GetConnectionString("AppDb")));
Configuration
Detail the available settings in DotEventOutbox
and their impact:
- ProcessingIntervalInSeconds: Defines the frequency of outbox processing cycles.
- MaxMessagesProcessedPerBatch: Limits the number of messages processed in a single batch to optimize performance.
- RetryIntervalInMilliseconds: Specifies the delay between retry attempts for failed message processing.
- MaxRetryAttempts: Sets the maximum number of retries for each message before moving it to the dead-letter queue.
// appsettings.json
{
"ConnectionStrings": {
"AppDb": "Your-Database-Connection-String"
},
"DotEventOutbox": {
"ProcessingIntervalInSeconds": 10,
"MaxMessagesProcessedPerBatch": 10,
"RetryIntervalInMilliseconds": 50,
"MaxRetryAttempts": 3
}
}
Example Usage
Below is an example demonstrating how to use DotEventOutbox in a console application:
// Program.cs
var user = new User(Guid.NewGuid(), "John Doe", "John.Doe@Demo.com");
dbContext.Users.Add(user);
var outboxCommitProcessor = scope.ServiceProvider.GetRequiredService<IOutboxCommitProcessor>();
await outboxCommitProcessor.ProcessAndSaveAsync(dbContext);
Contributing
We welcome contributions and suggestions! Please read through our contributing guidelines for more information on how to get started.
License
This project is licensed under the MIT License.
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. |
-
net8.0
- DotEventOutbox.Contracts (>= 1.0.1)
- MediatR (>= 12.2.0)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 8.2.0)
- Quartz (>= 3.8.0)
- Quartz.Extensions.Hosting (>= 3.8.0)
- Scrutor (>= 4.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.