DotEventOutbox 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotEventOutbox --version 1.0.4
NuGet\Install-Package DotEventOutbox -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotEventOutbox" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotEventOutbox --version 1.0.4
#r "nuget: DotEventOutbox, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.1 84 5/20/2024
1.1.0 210 12/26/2023
1.0.5 116 12/26/2023
1.0.4 128 12/25/2023
1.0.3 108 12/24/2023
1.0.2 112 12/22/2023
1.0.1 115 12/22/2023
1.0.0 110 12/21/2023