Trellis.EntityFrameworkCore.Outbox 3.0.0-alpha.582

This is a prerelease version of Trellis.EntityFrameworkCore.Outbox.
dotnet add package Trellis.EntityFrameworkCore.Outbox --version 3.0.0-alpha.582
                    
NuGet\Install-Package Trellis.EntityFrameworkCore.Outbox -Version 3.0.0-alpha.582
                    
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="Trellis.EntityFrameworkCore.Outbox" Version="3.0.0-alpha.582" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.EntityFrameworkCore.Outbox" Version="3.0.0-alpha.582" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.EntityFrameworkCore.Outbox" />
                    
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 Trellis.EntityFrameworkCore.Outbox --version 3.0.0-alpha.582
                    
#r "nuget: Trellis.EntityFrameworkCore.Outbox, 3.0.0-alpha.582"
                    
#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 Trellis.EntityFrameworkCore.Outbox@3.0.0-alpha.582
                    
#: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=Trellis.EntityFrameworkCore.Outbox&version=3.0.0-alpha.582&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.EntityFrameworkCore.Outbox&version=3.0.0-alpha.582&prerelease
                    
Install as a Cake Tool

Trellis.EntityFrameworkCore.Outbox

NuGet Package

Transactional outbox and post-commit domain-event dispatch for EF Core applications built with Trellis.

It captures domain events in the aggregate transaction and relays them after commit. Translators can then stage durable integration rows; publication guarantees depend on the configured publisher.

This package opts out of NativeAOT and trimming because it builds on EF Core and discovers integration-event types at runtime.

Installation

dotnet add package Trellis.EntityFrameworkCore.Outbox

Quick Example

protected override void OnModelCreating(ModelBuilder modelBuilder) =>
    modelBuilder.AddTrellisOutbox();

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseNpgsql(connectionString)
        .AddTrellisInterceptors()
        .AddTrellisOutboxInterceptor());

builder.Services.AddTrellis(trellis => trellis
    .UseDomainEvents(typeof(Program).Assembly)
    .UseIntegrationEvents(typeof(Program).Assembly)
    .UseEntityFrameworkUnitOfWork<AppDbContext>()
    .UseOutbox<AppDbContext>());

Translate domain events into integration events by adding them to IIntegrationEventCollector from a domain-event handler.

Key Features

  • Captures domain-event rows in the same transaction as aggregate changes.
  • Records provider-orderable UTC capture evidence for domain and translated integration rows.
  • Persists optional W3C trace context and business lineage on domain rows and translated integration rows.
  • Dispatches domain events only after a successful commit.
  • Publishes pending integration events through a resilient background service.
  • Supports configurable batching, locking, lease recovery, retry scheduling, and dead-lettering.
  • Exposes an explicit retryability contract for publisher failures.
  • Requires no broker dependency; transport packages implement IIntegrationEventPublisher.

Delivery Semantics

Domain rows use reporting dispatch to retry failed domain handlers, skipping saved completed-handler progress. Integration rows have one publisher handoff, not per-consumer retry progress. Default local fan-out is best-effort: ordinary consumer failures are logged and swallowed, so a new row is processed with Attempts == 0 and no relay LastError, and those consumers are not retried.

Broker adapters must await publication acceptance and propagate publication failures. An exposed failure keeps the row pending with an incremented failure count, retained error, and retry under the same message id. OperationCanceledException aborts the drain only when the relay token is canceled; an internal publisher timeout is recorded like any other failure. Acceptance is not consumer success. Transactional consumption requires an adapter to invoke the non-swallowing inbox and expose failures for transport redelivery; inbox registration does not reroute default local publication.

All three wiring steps are required: map the table, register AddTrellisOutboxInterceptor() for capture, and register the relay. Let the unit-of-work pipeline own SaveChangesAsync(). Carry OutboundIntegrationMessage.MessageId unchanged as the transport message ID so inbox consumers can deduplicate end to end.

The alpha outbox schema includes nullable CapturedAt, MessageSource, CausationId, CorrelationId, TraceParent, and TraceState columns; no migration or backfill is provided. New domain and translated rows receive their own UTC CapturedAt; legacy nulls remain unknown. Use IntegrationMessageContext.BeginCorrelation("workflow-id") to supply an application-owned business correlation id; one is never inferred from the trace.

Opt-in Outbox Readiness

Explicitly select OutboxReadinessOptions.CreateStagedOperationalProfile() and register services.AddTrellisOutboxReadiness<AppDbContext>(profile) or .UseOutboxReadiness<AppDbContext>(profile) alongside the relay. Existing outbox calls do not enable the named trellis-outbox .NET health check.

It reports bounded pending/parked metadata, optional durable capture age, optional application-provided consumer lag, local relay responsiveness, and separate durable row completions. Counts include leases/backoff and disclose lower bounds. Shared refreshes isolate caller cancellation; probe faults/timeouts are Unhealthy, and parked rows or missing initial relay evidence are Degraded. Tune the immutable profile with with for workload and relay timing.

Capture age defaults off for migration-first rollout. Add nullable UTC CapturedAt and the { ProcessedAt, CapturedAt, Sequence } index, deploy writers, then set CaptureAgeEnabled = true with a with expression. The inclusive reference thresholds are 2/10 minutes. Unknown legacy pending rows degrade and are counted separately; never backfill them from OccurredAt or migration time.

For consumer/source lag, register an application-owned IConsumerLagProvider and select ConsumerLagMeasures.Age, Count, or both on the same profile. Its aggregated ConsumerLagEvidence must conservatively report original sample time, complete partition coverage, oldest durably unaccounted source time and/or summed unaccounted count. Trellis applies inclusive 2/10-minute and 1,000/10,000 reference thresholds; missing, stale or future evidence and a lower-bound count below 1,000 degrade, while provider faults/shared-budget timeouts are Unhealthy. Fresh queue metadata sampled before a lag-provider timeout remains available. Inbox receipts and opaque checkpoints are never treated as lag.

For split API/worker hosts, keep local monitoring in the worker and select OutboxReadinessOptions.CreateMetadataOnlyProfile(workerMaxAttempts) in the API, using the same registration method without a relay. WorkerMaxAttempts must equal the worker's OutboxOptions.MaxAttempts; derive both from one configuration key or constant. Incidental local options are never resolved or compared, so mismatches generate no warning. Relay monitoring is disabled, not observed healthy. Metadata-only does not observe remote worker responsiveness. With capture age disabled, inactivity alone raises no signal until pending depth reaches 1,000 or a row is parked. Enabled age can detect an aging pending row, but does not prove the worker is dead. Probe faults and stale/invalid evidence still apply.

Generic Host lifecycle startup validates the actual matching relay in local mode, before hosted services start; decorators hiding the instance are unsupported. Context registration is checked without construction when supported by the container. Bare service providers do not run this startup validation.

The host owns endpoint authorization and traffic-readiness versus alert-only exposure: shared-store breaches can affect every replica. Degraded remains ready; selected Unhealthy fails readiness. No endpoint, mutation, or restart policy is added.

OccurredAt is not queue age, and publication is not downstream consumer success. See readiness APIs and diagnostics and the consumer-lag contract.

Documentation

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Trellis.EntityFrameworkCore.Outbox:

Package Downloads
Trellis.ServiceDefaults

Opinionated service composition defaults for Trellis web services. Provides a tiered builder that wires ASP integration, Mediator behaviors, FluentValidation, resource authorization, actor providers, and EF Core Unit of Work in canonical order.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-alpha.582 58 10/19/2026
3.0.0-alpha.574 62 10/14/2026
3.0.0-alpha.571 54 10/13/2026
3.0.0-alpha.557 92 10/8/2026
3.0.0-alpha.554 59 10/8/2026
3.0.0-alpha.553 52 10/7/2026
3.0.0-alpha.542 112 10/5/2026
3.0.0-alpha.539 64 10/4/2026
3.0.0-alpha.532 65 10/2/2026
3.0.0-alpha.527 63 10/1/2026
3.0.0-alpha.526 57 9/30/2026
3.0.0-alpha.524 67 9/27/2026
3.0.0-alpha.520 71 9/25/2026
3.0.0-alpha.516 157 9/22/2026
3.0.0-alpha.513 66 9/22/2026
3.0.0-alpha.505 72 9/13/2026
3.0.0-alpha.495 143 8/24/2026
3.0.0-alpha.458 116 8/19/2026
3.0.0-alpha.455 138 8/19/2026
3.0.0-alpha.449 84 8/18/2026
Loading failed