-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments
Milestone
Description
Title: Add transactional outbox behavior for reliable event publishing with Cortex.Streams
Labels: enhancement, mediator, new-package
Body:
Problem
When a command handler persists data and publishes notifications/events, there's a consistency gap: the database commit can succeed but the notification publish can fail (or vice versa). The transactional outbox pattern solves this by writing events to an outbox table within the same database transaction, then a background process relays them to the event bus.
This bridges the gap between Cortex.Mediator (in-process commands) and Cortex.Streams (event streaming).
Proposed Solution
Create a Cortex.Mediator.Outbox package:
IOutboxStoreinterface for persisting outbox messages (with EF Core and Dapper implementations)OutboxCommandBehavior<TCommand, TResult>-- captures notifications published during command handling and writes them to the outbox within the same transactionOutboxRelayService--IHostedServicethat polls the outbox and publishes to Cortex.Streams[PublishToOutbox]attribute to opt-in specific notifications
Relationship to Existing Packages
- Uses
Cortex.Mediator.Behaviors.Transactionalfor transaction management - Publishes to
Cortex.Streamsfor event distribution
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments