This commit is contained in:
2026-03-22 04:02:30 +01:00
parent 6ab9a3d2c2
commit 678419814a
23 changed files with 1318 additions and 70 deletions
@@ -0,0 +1,31 @@
using MassTransit;
using Microsoft.Extensions.Logging;
using Musify.Application.Contracts.Infrastructure;
using Musify.Infrastructure.Messaging.Activities.Arguments;
namespace Musify.Infrastructure.Messaging.Activities
{
public class TransferFilesToBucket(IStorageHandler storageHandler, ILogger<TransferFilesToBucket> logger)
: IExecuteActivity<TransferFilesToBucketArguments>
{
public const string ExecuteEndpointName = "Transfer-Files-To-Bucket";
public async Task<ExecutionResult> Execute(ExecuteContext<TransferFilesToBucketArguments> executeContext)
{
var transferFilesResult = await storageHandler.TransferFilesAsync(
executeContext.Arguments.FolderPath,
executeContext.Arguments.DestinationBucketName,
executeContext.Arguments.DestinationKeyName,
executeContext.CancellationToken);
if (!transferFilesResult.IsSuccess)
{
var errors = string.Join("; ", transferFilesResult.Errors);
logger.LogError($"An error occurred while transferring files to bucket: {errors}");
throw new Exception(errors);
}
return executeContext.Completed();
}
}
}