Vulthil.SharedKernel.Outbox
The transactional outbox engine — the message-capture model, the relay processor and background service, the
pluggable sinks (IOutboxDispatcher), the commit-time relay signal/gate, and the persistence-agnostic IOutboxStore
seam. It has no EF Core dependency; the EF implementation lives in
Vulthil.SharedKernel.Outbox.EntityFrameworkCore.
When to use
- You normally consume the outbox transitively. Reference
Vulthil.SharedKernel.Infrastructureand callEnableOutboxProcessing()— it hosts this engine and adds theDbContextbase + DI wiring. - Reference this package directly only when you need the EF-free engine contracts — for example a messaging
bridge such as
Vulthil.Messaging.Outbox, which captures and relays broker messages throughIOutboxStoreand depends on the engine alone (no EF Core, no infrastructure package).
Pattern
- One
OutboxMessagestable, one relay; rows are routed by anOutboxDestinationdiscriminator to the registeredIOutboxDispatcher, so in-process domain events and broker messages share a single outbox. - The engine relies on
IOutboxStorefor both capture (AddOutboxMessage/SaveChangesAsync/IsInTransaction) and the relay batch unit (ProcessBatchAsync); the EF implementation and provider stores supply the transaction and row-locking.AddOutboxEngineregisters the engine's own internals. - Relay spans are emitted on the
ActivitySource"Vulthil.SharedKernel.Outbox"(Telemetry.ActivitySourceName), auto-registered with OpenTelemetry byAddOutboxEngine(manual:tracing.AddVulthilOutboxInstrumentation()). - Relay metrics (counters
vulthil.outbox.relayed/vulthil.outbox.failed) are emitted on aMeter(Telemetry.MeterName), auto-registered byAddOutboxEnginewhenEnableMetricsis on (manual:metrics.AddVulthilOutboxInstrumentation()). - Opt into a retention sweep via
EnableOutboxProcessing(o => o.Retention.Enabled = true)to periodically delete processed and dead-lettered rows older than a window (relational set-basedExecuteDelete; the same sweep covers Cosmos).
See the Outbox Pattern article for the design, the pluggable-sink model, and the commit-time trigger.