feat(trading): add transactional domain event outbox#116
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughIntroduces a durable domain-event outbox pattern with a new Changes
Sequence Diagram(s)sequenceDiagram
participant Handler as Trading Handler
participant Aggregate as Order/Position<br/>Aggregate
participant Outbox as IDomainEventOutbox
participant UoW as TransactionalUnitOfWork
participant Dispatcher as IDomainEventDispatcher
Handler->>Aggregate: Execute domain operation
Aggregate-->>Handler: Generate domain events
Handler->>Handler: Collect events from aggregates
Handler->>Outbox: EnqueueAsync(events)
Outbox-->>Handler: Events queued (not yet persisted)
Handler->>Aggregate: Clear domain events
Handler->>UoW: CommitAsync()
UoW->>Outbox: Persist queued events to storage
UoW-->>Handler: Commit confirmed
Handler->>Dispatcher: DispatchManyAsync(events)
Dispatcher-->>Handler: Events dispatched to subscribers
Handler->>Outbox: MarkProcessedAsync(eventId)
Outbox-->>Handler: Event marked as processed
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Acceptance Criteria
Changes
IDomainEventOutboxandDomainEventOutboxMessageas application ports.JsonDomainEventOutboxand Autofac registration using the existing JSON transaction coordinator.DomainEventOutboxWorkflow.Testing
dotnet test IntelliTrader.sln --configuration Release --no-restore --no-build.git diff --check.Checklist
Summary by CodeRabbit
New Features
Tests