- Flatten nested per-repo folders into flat Musify.* projects at root - Rename assemblies/csproj: Domain->Musify.Domain, Application->Musify.Application, Infrastructure->Musify.Infrastructure, WebApi->Musify.Api, Worker->Musify.Worker, StreamingGateway->Musify.StreamingGateway - Rename WebApi.* namespaces to Musify.Api.* - Update all ProjectReference paths and the solution file - Consolidate stray per-repo dotfiles; add root .gitattributes - Move flutter client out to _archive Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
using MassTransit;
|
|
using MassTransit.Courier.Contracts;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Musify.Infrastructure.MassTransit.Consumers
|
|
{
|
|
public class RoutingSlipCleanUpConsumer(
|
|
ILogger<RoutingSlipCleanUpConsumer> logger) :
|
|
IConsumer<RoutingSlipCompleted>,
|
|
IConsumer<RoutingSlipFaulted>
|
|
{
|
|
public const string QueueName = "routing-slip-events";
|
|
|
|
public Task Consume(ConsumeContext<RoutingSlipCompleted> consumeContext)
|
|
=> DeleteFolder(consumeContext.Message.Variables);
|
|
|
|
public Task Consume(ConsumeContext<RoutingSlipFaulted> consumeContext)
|
|
=> DeleteFolder(consumeContext.Message.Variables);
|
|
|
|
Task DeleteFolder(IDictionary<string, object> variables)
|
|
{
|
|
if (!variables.TryGetValue(RoutingSlipVariableNames.Workflow.TemporalDirectory, out var pathObject))
|
|
return Task.CompletedTask;
|
|
|
|
var pathString = pathObject.ToString();
|
|
|
|
if (string.IsNullOrEmpty(pathString))
|
|
return Task.CompletedTask;
|
|
|
|
try
|
|
{
|
|
Directory.Delete(pathString, recursive: true);
|
|
logger.LogInformation("Deleted temporal directory at path {Path}", pathString);
|
|
}
|
|
catch (DirectoryNotFoundException directoryNotFoundException)
|
|
{
|
|
logger.LogWarning(directoryNotFoundException, "Temporal directory at path {Path} was not found for deletion", pathString);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
logger.LogError(exception, "Failed to delete temporal directory at path {Path}", pathString);
|
|
throw;
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
} |