feat(infra): add Track processing saga (state machine, phase 1)
Introduce a MassTransit saga state machine that correlates by TrackId and
tracks the two parallel processing slips (picture + audio):
- TrackProcessingStateMachine + EF-persisted TrackProcessingState
(pessimistic concurrency, EntityFrameworkRepository), migration added
- Starts on CreateTrackResourcesEvent; UpdateTrack{Picture,Audio}Activity now
publish TrackPictureProcessed / TrackAudioProcessed on success; when both
arrive the saga finalizes (Ready). Failure transitions to a Failed state
(cleanup wired in the next phase)
- Add LifeCycleStatus.Failed and the four outcome events
Verified: booted the Worker against RabbitMQ + migrated Postgres in Docker;
the saga endpoint 'track-processing-state' is configured and the bus starts
clean.
Build: 0 warnings, 0 errors.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+9
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Musify.Application.Contracts;
|
||||
using Musify.Infrastructure.Configuration;
|
||||
using Musify.Infrastructure.MassTransit.Sagas;
|
||||
using Musify.Infrastructure.Persistence;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit
|
||||
@@ -66,6 +67,14 @@ namespace Musify.Infrastructure.MassTransit
|
||||
|
||||
RegisterConsumersAndActivities(options);
|
||||
|
||||
options.AddSagaStateMachine<TrackProcessingStateMachine, TrackProcessingState>()
|
||||
.EntityFrameworkRepository(repository =>
|
||||
{
|
||||
repository.ConcurrencyMode = ConcurrencyMode.Pessimistic;
|
||||
repository.ExistingDbContext<Database>();
|
||||
repository.UsePostgres();
|
||||
});
|
||||
|
||||
options.AddConfigureEndpointsCallback((registrationContext, _, endpointConfigurator) =>
|
||||
{
|
||||
UseStandardRetry(endpointConfigurator);
|
||||
|
||||
Reference in New Issue
Block a user