Outboxer 1.1.0

dotnet add package Outboxer --version 1.1.0
NuGet\Install-Package Outboxer -Version 1.1.0
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="Outboxer" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Outboxer --version 1.1.0
#r "nuget: Outboxer, 1.1.0"
#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 Outboxer as a Cake Addin
#addin nuget:?package=Outboxer&version=1.1.0

// Install Outboxer as a Cake Tool
#tool nuget:?package=Outboxer&version=1.1.0

--- This update requires a new migration to be added ---

Outboxer outboxerIcon

Available at GitHub

This lib intends to provide a simple and broker agnostic Outbox Pattern implementation.

The only requirement to use Outboxer is to use Entity Framework as we use its built-in Unit-Of-Work to assure everything is saved at the same time and guarantee consistency.

To use Outboxer follow these steps

  • Make sure your DbContext inherits OutboxerContext<T>. If the name of your context is StudentsContext, your class should look like this.
public class StudentsContext : OutboxerContext<StudentsContext>
{
    public StudentsContext(DbContextOptions<StudentsContext> options,
        ITransactionalMessageContainer transactionalMessageContainer) : base(options, transactionalMessageContainer)
    {
    }

    // Your code
}
  • Run dotnet ef migrations add/dotnet ef database update to create the outbox table

  • Register Outboxer using services.AddOutboxer<StudentsContext>(); at your Startup.cs or Program.cs(.net core 6+)

  • To be broker agnostic means that you'll have to implement your own broker communication mechanism. Make sure your class implements the IBrokerPublisher interface. All your sending logic should be inside Publish method.

  • Register your custom broker communication class on DI container using services.AddScoped<IBrokerPublisher, MyBrokerImplementation>(). You can use AddSingleton as well.

  • To publish a message inject the interface IPublisher and use the Publish method like this await _publisher.Publish(new Entry("studentsQueue", messageContent));. The content will just be added to outbox and enqueued on your broker if the database commit runs fine.


Important warnings

If the BackgroundWorker that sends the messages gets restarted it will re-enqueue ALL the messages with ENQUEUED status at the outbox table. This normaly just occurs when the app gets restarted, yet it is a good idea to implement idempotency at your consumers.

Currently there is no Dead-Letter implementation. If a message reaches the maximum amount of retries it will rest in the table with FAILED status. DLQ Handling to be implemented in next version.


Messages Status

  • 1 - Pending
  • 2 - Enqueued
  • 3 - Delivered
  • 4 - Failed

Changelog

v1.1.0 - Fixing bug that was preventing the persistence of Destination and Retries on the outbox table. - REQUIRES MIGRATION

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.0 575 8/25/2023
1.0.1 1,194 9/15/2022
1.0.0 405 8/22/2022