feat(outbox): replay pending domain events#117
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughIntroduces durable domain event outbox processing infrastructure. Adds Changes
Sequence Diagram(s)sequenceDiagram
participant Core as CoreService
participant Replay as DomainEventOutboxReplayService
participant Background as DomainEventOutboxProcessorService
participant Processor as DomainEventOutboxProcessor
participant Outbox as IDomainEventOutbox
participant Dispatcher as IDomainEventDispatcher
Core->>Replay: Start()
activate Replay
Replay->>Background: new + Start()
activate Background
Background->>Background: TimedBackgroundService timer
Background->>Processor: ProcessPendingAsync(batchSize, token)
activate Processor
Processor->>Outbox: GetUnprocessedAsync(batchSize)
Outbox-->>Processor: List<DomainEventOutboxMessage>
loop For Each Message
Processor->>Processor: Deserialize & Validate
Processor->>Dispatcher: DispatchAsync(event)
Dispatcher-->>Processor: Success
Processor->>Outbox: MarkAsProcessedAsync(messageId)
end
Processor-->>Background: DomainEventOutboxProcessingResult
deactivate Processor
Background-->>Replay: (scheduled execution)
deactivate Background
Core->>Replay: Stop()
Replay->>Background: Stop()
activate Background
Background->>Background: Cancel token & dispose
deactivate Background
deactivate Replay
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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
IDomainEventOutboxProcessorandDomainEventOutboxProcessingResultapplication port.DomainEventOutboxProcessorfor pending message replay and per-message failure isolation.DomainEventOutboxProcessorServiceand Core-facingDomainEventOutboxReplayService.CoreService.Testing
dotnet test tests/IntelliTrader.Infrastructure.Tests/IntelliTrader.Infrastructure.Tests.csproj --no-restore --filter "FullyQualifiedName~DomainEventOutboxProcessorTests|FullyQualifiedName~DomainEventOutboxProcessorServiceTests"dotnet test tests/IntelliTrader.Core.Tests/IntelliTrader.Core.Tests.csproj --no-restore --filter "FullyQualifiedName~DomainEventOutboxReplayService|FullyQualifiedName~ActiveOrderRefreshService"dotnet test IntelliTrader.sln --configuration Release --no-restoregit diff --checkChecklist
Summary by CodeRabbit