refactor(infra): auto-configure MassTransit endpoints via ConfigureEndpoints
Replace ~240 lines of hand-written per-endpoint wiring with MassTransit's ConfigureEndpoints + KebabCaseEndpointNameFormatter, and apply retry + EF outbox globally through AddConfigureEndpointsCallback. Adding a consumer or activity is now a single AddConsumer/AddActivity line. - Normalize the 4 mismatched activity endpoint names to kebab-case so the routing-slip addressing keeps resolving (update-play-list-picture, delete/mark/publish play-list variants); cleanup consumer queue is now routing-slip-clean-up - Drop the now-unused QueueName consts from event consumers and trim EndpointHelper / delete the manual endpoint-config partial Verified end-to-end: booted the Worker against RabbitMQ in Docker and confirmed all 38 endpoints are configured with the exact names the builders address (19 execute queues + compensations + consumers + routing-slip-clean-up). Build: 0 warnings, 0 errors.
This commit is contained in:
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
PlayListPictureSourceRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<CreatePlayListResourcesEvent>
|
||||
{
|
||||
public const string QueueName = "create-playList";
|
||||
|
||||
public async Task Consume(ConsumeContext<CreatePlayListResourcesEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
CreateTrackRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<CreateTrackResourcesEvent>
|
||||
{
|
||||
public const string QueueName = "create-track";
|
||||
|
||||
public async Task Consume(ConsumeContext<CreateTrackResourcesEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
DeletePlayListRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<DeletePlayListEvent>
|
||||
{
|
||||
public const string QueueName = "delete-playList";
|
||||
|
||||
public async Task Consume(ConsumeContext<DeletePlayListEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
DeleteTrackRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<DeleteTrackEvent>
|
||||
{
|
||||
public const string QueueName = "delete-track";
|
||||
|
||||
public async Task Consume(ConsumeContext<DeleteTrackEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -2,13 +2,7 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
{
|
||||
internal static class EndpointHelper
|
||||
{
|
||||
internal static string ExecuteQueueName(string endpointName) => $"{endpointName}_execute";
|
||||
|
||||
internal static string CompensateQueueName(string endpointName) => $"{endpointName}_compensate";
|
||||
|
||||
internal static Uri BuildExecuteActivityUri(string endpointName) => new($"queue:{ExecuteQueueName(endpointName)}");
|
||||
|
||||
internal static Uri BuildCompensateActivityUri(string endpointName) => new($"queue:{CompensateQueueName(endpointName)}");
|
||||
internal static Uri BuildExecuteActivityUri(string endpointName) => new($"queue:{endpointName}_execute");
|
||||
|
||||
internal static Uri BuildConsumerUri(string endpointName) => new($"queue:{endpointName}");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
IConsumer<RoutingSlipCompleted>,
|
||||
IConsumer<RoutingSlipFaulted>
|
||||
{
|
||||
public const string QueueName = "routing-slip-events";
|
||||
public const string QueueName = "routing-slip-clean-up";
|
||||
|
||||
public Task Consume(ConsumeContext<RoutingSlipCompleted> consumeContext)
|
||||
=> DeleteFolder(consumeContext.Message.Variables);
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
PictureWorkflowRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<UpdatePlayListPictureEvent>
|
||||
{
|
||||
public const string QueueName = "update-playList-picture";
|
||||
|
||||
public async Task Consume(ConsumeContext<UpdatePlayListPictureEvent> consumeContext)
|
||||
{
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
PlayListPictureSourceRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<UpdatePlayListPictureSourceEvent>
|
||||
{
|
||||
public const string QueueName = "update-playList-picture-source";
|
||||
|
||||
public async Task Consume(ConsumeContext<UpdatePlayListPictureSourceEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
AudioWorkflowRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<UpdateTrackAudioEvent>
|
||||
{
|
||||
public const string QueueName = "update-track-audio";
|
||||
|
||||
public async Task Consume(ConsumeContext<UpdateTrackAudioEvent> consumeContext)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
PictureWorkflowRoutingSlipBuilder routingSlipBuilder)
|
||||
: IConsumer<UpdateTrackPictureEvent>
|
||||
{
|
||||
public const string QueueName = "update-track-picture";
|
||||
|
||||
public async Task Consume(ConsumeContext<UpdateTrackPictureEvent> consumeContext)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user