DAMA.Software.MySqlOutbox 2.0.0

dotnet add package DAMA.Software.MySqlOutbox --version 2.0.0
                    
NuGet\Install-Package DAMA.Software.MySqlOutbox -Version 2.0.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="DAMA.Software.MySqlOutbox" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DAMA.Software.MySqlOutbox" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DAMA.Software.MySqlOutbox" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DAMA.Software.MySqlOutbox --version 2.0.0
                    
#r "nuget: DAMA.Software.MySqlOutbox, 2.0.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.
#:package DAMA.Software.MySqlOutbox@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DAMA.Software.MySqlOutbox&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DAMA.Software.MySqlOutbox&version=2.0.0
                    
Install as a Cake Tool

DAMA.Software.MySqlOutbox

Helpers for the transactional Outbox pattern on MySQL. Extracted from duplicated code in the DAMA Auth and Payment services and published as a NuGet package so every backend that needs an outbox table can consume the same lease / failure recording logic.

What it provides

  • IOutboxEvent — interface implemented by every outbox-row entity. Requires Id (Guid), OccurredAt (DateTime) and a settable Attempts (int).
  • OutboxLeaseDescriptor<TEvent> — record that tells the helper how to read a particular outbox table: table name, SELECT columns, pending predicate, and a mapper from MySqlDataReader to TEvent.
  • MySqlOutboxLeaseHelper.LeaseAsync<TEvent>(...) — runs the SELECT ... FOR UPDATE SKIP LOCKED + UPDATE LeasedUntil/Attempts cycle in a single transaction and returns the leased events.
  • MySqlOutboxLeaseHelper.RecordFailureAsync(...) — clears the lease and stores the last error on a row.

Why it exists

Every DAMA outbox table shares the same lease semantics: pick up to N pending rows that nobody is currently leasing, claim them for a few seconds, and let a worker publish them. The schemas around them (column names, additional state columns, terminal transitions) differ by service, but the lease cycle does not. This package owns that lease cycle so it does not have to be copy-pasted across services.

Requirements on the consumer table

Every outbox table must have, at minimum, columns named:

  • Id (Guid / CHAR(36))
  • OccurredAt (DATETIME / TIMESTAMP)
  • Attempts (INT)
  • LeasedUntil (DATETIME, nullable)
  • LastError (VARCHAR / TEXT, nullable)

Other columns are free; the descriptor lets the consumer choose which to project.

Example

See OutboxEventDao in the DAMA Auth service and PaymentOutboxDao in the DAMA Payment service for production usage.

License

MIT.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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
2.0.0 145 5/28/2026
1.0.0 143 5/19/2026