Rename variables
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Musify.Application.Events
|
||||||
|
{
|
||||||
|
public record ImageSize(
|
||||||
|
string SavePath,
|
||||||
|
int Width,
|
||||||
|
int Height);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Musify.Application.Events
|
namespace Musify.Application.Events
|
||||||
{
|
{
|
||||||
public record RemoveFileEvent(
|
public record RemoveFileEvent(
|
||||||
string BucketName,
|
string Bucket,
|
||||||
string KeyName);
|
string Key);
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,9 @@
|
|||||||
{
|
{
|
||||||
public record UpdatePlayListPictureEvent(
|
public record UpdatePlayListPictureEvent(
|
||||||
Guid PlayListId,
|
Guid PlayListId,
|
||||||
string SourceBucketName,
|
string Bucket,
|
||||||
string SourceKeyName,
|
string SourceKey,
|
||||||
string SmallPictureRoute,
|
ImageSize Small,
|
||||||
int SmallPictureWidth,
|
ImageSize Medium,
|
||||||
int SmallPictureHeight,
|
ImageSize Large);
|
||||||
string MediumPictureRoute,
|
|
||||||
int MediumPictureWidth,
|
|
||||||
int MediumPictureHeight,
|
|
||||||
string LargePictureRoute,
|
|
||||||
int LargePictureWidth,
|
|
||||||
int LargePictureHeight);
|
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public record UpdateTrackAudioEvent(
|
public record UpdateTrackAudioEvent(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string SourceBucketName,
|
string SourceBucket,
|
||||||
string SourceKeyName,
|
string SourceKey,
|
||||||
string DestinationBucketName,
|
string DestinationBucket,
|
||||||
string DestinationFolderKeyName);
|
string DestinationFolderKey);
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,9 @@
|
|||||||
{
|
{
|
||||||
public record UpdateTrackPictureEvent(
|
public record UpdateTrackPictureEvent(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string SourceBucketName,
|
string Bucket,
|
||||||
string SourceKeyName,
|
string SourceKey,
|
||||||
string SmallPictureRoute,
|
ImageSize Small,
|
||||||
int SmallPictureWidth,
|
ImageSize Medium,
|
||||||
int SmallPictureHeight,
|
ImageSize Large);
|
||||||
string MediumPictureRoute,
|
|
||||||
int MediumPictureWidth,
|
|
||||||
int MediumPictureHeight,
|
|
||||||
string LargePictureRoute,
|
|
||||||
int LargePictureWidth,
|
|
||||||
int LargePictureHeight);
|
|
||||||
}
|
}
|
||||||
@@ -95,21 +95,25 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
return uploadFileResult;
|
return uploadFileResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKey, PlayList playList, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
||||||
playList.Id,
|
playList.Id,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
originalPictureKeyName,
|
originalPictureKey,
|
||||||
playListConfiguration.Routes.SmallPicturesPath,
|
new ImageSize(
|
||||||
playListConfiguration.PicturesSizes.SmallPictureWidth,
|
playListConfiguration.Routes.SmallPicturesPath,
|
||||||
playListConfiguration.PicturesSizes.SmallPictureHeight,
|
playListConfiguration.PicturesSizes.SmallPictureWidth,
|
||||||
playListConfiguration.Routes.MediumPicturesPath,
|
playListConfiguration.PicturesSizes.SmallPictureHeight),
|
||||||
playListConfiguration.PicturesSizes.MediumPictureWidth,
|
new ImageSize(
|
||||||
playListConfiguration.PicturesSizes.MediumPictureHeight,
|
playListConfiguration.Routes.MediumPicturesPath,
|
||||||
playListConfiguration.Routes.LargePicturesPath,
|
playListConfiguration.PicturesSizes.MediumPictureWidth,
|
||||||
playListConfiguration.PicturesSizes.LargePictureWidth,
|
playListConfiguration.PicturesSizes.MediumPictureHeight),
|
||||||
playListConfiguration.PicturesSizes.LargePictureHeight), cancellationToken);
|
new ImageSize(
|
||||||
|
playListConfiguration.Routes.LargePicturesPath,
|
||||||
|
playListConfiguration.PicturesSizes.LargePictureWidth,
|
||||||
|
playListConfiguration.PicturesSizes.LargePictureHeight)),
|
||||||
|
cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,11 +92,11 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
database.PlayLists.Update(playList);
|
database.PlayLists.Update(playList);
|
||||||
await database.SaveChangesAsync(cancellationToken);
|
await database.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
logger.LogInformation("Updated PlayList with id={PlayListId} and picture key {PictureKeyName}.", playList.Id, newImageStorageKey);
|
logger.LogInformation("Updated PlayList with id={PlayListId} and picture key {PictureKey}.", playList.Id, newImageStorageKey);
|
||||||
return Result.Success(PlayListResponse.FromEntity(playList));
|
return Result.Success(PlayListResponse.FromEntity(playList));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<Result> PublishRemoveFileEvent(string keyName, CancellationToken cancellationToken)
|
async Task<Result> PublishRemoveFileEvent(string key, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -104,14 +104,14 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
Path.Combine(
|
Path.Combine(
|
||||||
playListConfiguration.Routes.ParentFolders,
|
playListConfiguration.Routes.ParentFolders,
|
||||||
keyName)), cancellationToken);
|
key)), cancellationToken);
|
||||||
|
|
||||||
return Result.NoContent();
|
return Result.NoContent();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "Failed to publish remove file event for key {KeyName}.", keyName);
|
logger.LogError(exception, "Failed to publish remove file event for key {Key}.", key);
|
||||||
return Result.Error($"Failed to publish remove file event for key {keyName}.");
|
return Result.Error($"Failed to publish remove file event for key {key}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,21 +127,25 @@ namespace Musify.Application.PlayLists.Handlers
|
|||||||
return uploadFileResult;
|
return uploadFileResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task PublishUpdateEvent(string originalPictureKeyName, PlayList playList, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKey, PlayList playList, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
await eventBus.PublishAsync(new UpdatePlayListPictureEvent(
|
||||||
playList.Id,
|
playList.Id,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
originalPictureKeyName,
|
originalPictureKey,
|
||||||
playListConfiguration.Routes.SmallPicturesPath,
|
new ImageSize(
|
||||||
playListConfiguration.PicturesSizes.SmallPictureWidth,
|
playListConfiguration.Routes.SmallPicturesPath,
|
||||||
playListConfiguration.PicturesSizes.SmallPictureHeight,
|
playListConfiguration.PicturesSizes.SmallPictureWidth,
|
||||||
playListConfiguration.Routes.MediumPicturesPath,
|
playListConfiguration.PicturesSizes.SmallPictureHeight),
|
||||||
playListConfiguration.PicturesSizes.MediumPictureWidth,
|
new ImageSize(
|
||||||
playListConfiguration.PicturesSizes.MediumPictureHeight,
|
playListConfiguration.Routes.MediumPicturesPath,
|
||||||
playListConfiguration.Routes.LargePicturesPath,
|
playListConfiguration.PicturesSizes.MediumPictureWidth,
|
||||||
playListConfiguration.PicturesSizes.LargePictureWidth,
|
playListConfiguration.PicturesSizes.MediumPictureHeight),
|
||||||
playListConfiguration.PicturesSizes.LargePictureHeight), cancellationToken);
|
new ImageSize(
|
||||||
|
playListConfiguration.Routes.LargePicturesPath,
|
||||||
|
playListConfiguration.PicturesSizes.LargePictureWidth,
|
||||||
|
playListConfiguration.PicturesSizes.LargePictureHeight)),
|
||||||
|
cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,9 +38,9 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
LargePictureKeyName = trackConfiguration.Routes.PresetLargePicture,
|
LargePictureKeyName = trackConfiguration.Routes.PresetLargePicture,
|
||||||
};
|
};
|
||||||
|
|
||||||
var originalPictureKeyName = Path.Combine(trackConfiguration.Routes.OriginalPicturesPath,
|
var originalPictureKey = Path.Combine(trackConfiguration.Routes.OriginalPicturesPath,
|
||||||
originalPictureFileName);
|
originalPictureFileName);
|
||||||
var pictureUploadResult = await UploadFile(request.Picture, originalPictureKeyName, cancellationToken);
|
var pictureUploadResult = await UploadFile(request.Picture, originalPictureKey, cancellationToken);
|
||||||
if (!pictureUploadResult.IsSuccess)
|
if (!pictureUploadResult.IsSuccess)
|
||||||
{
|
{
|
||||||
logger.LogError("Failed to upload picture for track {TrackTitle}", request.Title);
|
logger.LogError("Failed to upload picture for track {TrackTitle}", request.Title);
|
||||||
@@ -48,9 +48,9 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var audioKeyName = Path.Combine(trackConfiguration.Routes.OriginalAudiosPath,
|
var audioKey = Path.Combine(trackConfiguration.Routes.OriginalAudiosPath,
|
||||||
Guid.NewGuid() + request.Audio.FileType);
|
Guid.NewGuid() + request.Audio.FileType);
|
||||||
var audioUploadResult = await UploadFile(request.Audio, audioKeyName, cancellationToken);
|
var audioUploadResult = await UploadFile(request.Audio, audioKey, cancellationToken);
|
||||||
if (!audioUploadResult.IsSuccess)
|
if (!audioUploadResult.IsSuccess)
|
||||||
{
|
{
|
||||||
logger.LogError("Failed to upload audio for track {TrackTitle}", request.Title);
|
logger.LogError("Failed to upload audio for track {TrackTitle}", request.Title);
|
||||||
@@ -59,7 +59,7 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await PublishUpdateEvent(originalPictureKeyName, track, cancellationToken);
|
await PublishUpdateEvent(originalPictureKey, track, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@@ -83,36 +83,39 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
return Result.Success();
|
return Result.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<Result<string>> UploadFile(IFileData fileData, string keyName, CancellationToken cancellationToken)
|
async Task<Result<string>> UploadFile(IFileData fileData, string key, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var uploadFile = await storageHandler.UploadFileAsync(
|
var uploadFile = await storageHandler.UploadFileAsync(
|
||||||
fileData.FileStream,
|
fileData.FileStream,
|
||||||
fileData.ContentType,
|
fileData.ContentType,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
keyName,
|
key,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
|
||||||
return uploadFile;
|
return uploadFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task PublishUpdateEvent(string originalPictureKeyName, Track track, CancellationToken cancellationToken)
|
async Task PublishUpdateEvent(string originalPictureKey, Track track, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await eventBus.PublishAsync(new UpdateTrackPictureEvent(
|
await eventBus.PublishAsync(new UpdateTrackPictureEvent(
|
||||||
track.Id,
|
track.Id,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
originalPictureKeyName,
|
originalPictureKey,
|
||||||
trackConfiguration.Routes.SmallPicturesPath,
|
new ImageSize(
|
||||||
trackConfiguration.PicturesSizes.SmallPictureWidth,
|
trackConfiguration.Routes.PresetSmallPicture,
|
||||||
trackConfiguration.PicturesSizes.SmallPictureHeight,
|
trackConfiguration.PicturesSizes.SmallPictureWidth,
|
||||||
trackConfiguration.Routes.MediumPicturesPath,
|
trackConfiguration.PicturesSizes.SmallPictureHeight),
|
||||||
trackConfiguration.PicturesSizes.MediumPictureWidth,
|
new ImageSize(
|
||||||
trackConfiguration.PicturesSizes.MediumPictureHeight,
|
trackConfiguration.Routes.PresetMediumPicture,
|
||||||
trackConfiguration.Routes.LargePicturesPath,
|
trackConfiguration.PicturesSizes.MediumPictureWidth,
|
||||||
trackConfiguration.PicturesSizes.LargePictureWidth,
|
trackConfiguration.PicturesSizes.MediumPictureHeight),
|
||||||
trackConfiguration.PicturesSizes.LargePictureHeight), cancellationToken);
|
new ImageSize(
|
||||||
|
trackConfiguration.Routes.PresetLargePicture,
|
||||||
|
trackConfiguration.PicturesSizes.LargePictureWidth,
|
||||||
|
trackConfiguration.PicturesSizes.LargePictureHeight)), cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task PublishTranscodeEvent(Guid trackId, string audioKeyName, CancellationToken cancellationToken)
|
async Task PublishTranscodeEvent(Guid trackId, string audioKey, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var destinationFolderAudio = Path.Combine(trackConfiguration.Routes.ProcessedAudiosPath,
|
var destinationFolderAudio = Path.Combine(trackConfiguration.Routes.ProcessedAudiosPath,
|
||||||
Guid.NewGuid().ToString());
|
Guid.NewGuid().ToString());
|
||||||
@@ -120,7 +123,7 @@ namespace Musify.Application.Tracks.Handler
|
|||||||
await eventBus.PublishAsync(new UpdateTrackAudioEvent(
|
await eventBus.PublishAsync(new UpdateTrackAudioEvent(
|
||||||
trackId,
|
trackId,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
audioKeyName,
|
audioKey,
|
||||||
storageConfiguration.BucketName,
|
storageConfiguration.BucketName,
|
||||||
destinationFolderAudio), cancellationToken);
|
destinationFolderAudio), cancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var folderName = Guid.NewGuid().ToString();
|
var folderName = Guid.NewGuid().ToString();
|
||||||
var sourceFileName = Path.GetFileName(executeContext.Arguments.SourceKeyName);
|
var sourceFileName = Path.GetFileName(executeContext.Arguments.SourceKey);
|
||||||
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, folderName);
|
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, folderName);
|
||||||
var sourceFilePath = Path.Combine(workingDirectory, sourceFileName);
|
var sourceFilePath = Path.Combine(workingDirectory, sourceFileName);
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "Error generating audio workflow paths for key {SourceKeyName}",
|
logger.LogError(exception, "Error generating audio workflow paths for key {SourceKeyName}",
|
||||||
executeContext.Arguments.SourceKeyName);
|
executeContext.Arguments.SourceKey);
|
||||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.SourceFilePathVariableName);
|
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.SourceFilePathVariable);
|
||||||
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
||||||
var workingDirectory = executeContext.GetVariable<string>(executeContext.Arguments.WorkingDirectoryVariableName);
|
var workingDirectory = executeContext.GetVariable<string>(executeContext.Arguments.WorkingDirectoryVariable);
|
||||||
ArgumentNullException.ThrowIfNull(workingDirectory, nameof(workingDirectory));
|
ArgumentNullException.ThrowIfNull(workingDirectory, nameof(workingDirectory));
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
|||||||
track.Id,
|
track.Id,
|
||||||
track.AudioFolderKeyName);
|
track.AudioFolderKeyName);
|
||||||
|
|
||||||
track.AudioFolderKeyName = Path.GetFileName(executeContext.Arguments.AudioFolderKeyName);
|
track.AudioFolderKeyName = Path.GetFileName(executeContext.Arguments.AudioFolderKey);
|
||||||
|
|
||||||
database.Tracks.Update(track);
|
database.Tracks.Update(track);
|
||||||
await database.SaveChangesAsync(executeContext.CancellationToken);
|
await database.SaveChangesAsync(executeContext.CancellationToken);
|
||||||
@@ -81,7 +81,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
|||||||
return compensateContext.Compensated();
|
return compensateContext.Compensated();
|
||||||
}
|
}
|
||||||
|
|
||||||
track.AudioFolderKeyName = compensateContext.Log.PreviousFolderAudioKeyName;
|
track.AudioFolderKeyName = compensateContext.Log.PreviousFolderAudioKey;
|
||||||
|
|
||||||
database.Tracks.Update(track);
|
database.Tracks.Update(track);
|
||||||
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
||||||
|
|||||||
@@ -31,22 +31,22 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var destinationPath = executeContext.GetVariable<string>(executeContext.Arguments.DestinationFilePathVariableName);
|
var destinationPath = executeContext.GetVariable<string>(executeContext.Arguments.DestinationFilePathVariable);
|
||||||
ArgumentNullException.ThrowIfNull(destinationPath, nameof(destinationPath));
|
ArgumentNullException.ThrowIfNull(destinationPath, nameof(destinationPath));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var getFile = await storageHandler.GetFileAsync(
|
var getFile = await storageHandler.GetFileAsync(
|
||||||
executeContext.Arguments.BucketName,
|
executeContext.Arguments.Bucket,
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
if (!getFile.IsSuccess)
|
if (!getFile.IsSuccess)
|
||||||
{
|
{
|
||||||
var errorMessage = string.Join("; ", getFile.Errors);
|
var errorMessage = string.Join("; ", getFile.Errors);
|
||||||
logger.LogWarning("Failed to download file from bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
|
logger.LogWarning("Failed to download file from bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
|
||||||
executeContext.Arguments.BucketName,
|
executeContext.Arguments.Bucket,
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
errorMessage);
|
errorMessage);
|
||||||
throw new Exception(errorMessage);
|
throw new Exception(errorMessage);
|
||||||
}
|
}
|
||||||
@@ -64,8 +64,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
|
|
||||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||||
return executeContext.Completed(new DownloadFileFromBucketLog(
|
return executeContext.Completed(new DownloadFileFromBucketLog(
|
||||||
executeContext.Arguments.BucketName,
|
executeContext.Arguments.Bucket,
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
destinationPath));
|
destinationPath));
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var removeFile = await storageHandler.RemoveFileAsync(
|
var removeFile = await storageHandler.RemoveFileAsync(
|
||||||
executeContext.Arguments.BucketName,
|
executeContext.Arguments.Bucket,
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
if (!removeFile.IsSuccess)
|
if (!removeFile.IsSuccess)
|
||||||
{
|
{
|
||||||
var errorMessage = string.Join("; ", removeFile.Errors);
|
var errorMessage = string.Join("; ", removeFile.Errors);
|
||||||
logger.LogWarning("Failed to remove file {KeyName} from bucket {BucketName}. Errors: {Errors}",
|
logger.LogWarning("Failed to remove file {KeyName} from bucket {BucketName}. Errors: {Errors}",
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
executeContext.Arguments.BucketName,
|
executeContext.Arguments.Bucket,
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "Error removing file {KeyName} from bucket {BucketName}",
|
logger.LogError(exception, "Error removing file {KeyName} from bucket {BucketName}",
|
||||||
executeContext.Arguments.KeyName,
|
executeContext.Arguments.Key,
|
||||||
executeContext.Arguments.BucketName);
|
executeContext.Arguments.Bucket);
|
||||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,22 +31,21 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var folderPath = executeContext.GetVariable<string>(executeContext.Arguments.SourceDirectoryVariableName);
|
var folderPath = executeContext.GetVariable<string>(executeContext.Arguments.SourceDirectoryVariable);
|
||||||
ArgumentNullException.ThrowIfNull(folderPath, nameof(folderPath));
|
ArgumentNullException.ThrowIfNull(folderPath, nameof(folderPath));
|
||||||
|
var destinationKey = executeContext.Arguments.DestinationKey;
|
||||||
var destinationKeyName = executeContext.Arguments.DestinationKeyName;
|
ArgumentNullException.ThrowIfNull(destinationKey, nameof(destinationKey));
|
||||||
ArgumentNullException.ThrowIfNull(destinationKeyName, nameof(destinationKeyName));
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var uploadedKeys = Directory.GetFiles(folderPath)
|
var uploadedKeys = Directory.GetFiles(folderPath)
|
||||||
.Select(file => Path.Combine(destinationKeyName, Path.GetFileName(file)))
|
.Select(file => Path.Combine(destinationKey, Path.GetFileName(file)))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var transferFilesResult = await storageHandler.TransferFilesAsync(
|
var transferFilesResult = await storageHandler.TransferFilesAsync(
|
||||||
folderPath,
|
folderPath,
|
||||||
executeContext.Arguments.DestinationBucketName,
|
executeContext.Arguments.DestinationBucket,
|
||||||
destinationKeyName,
|
destinationKey,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
if (!transferFilesResult.IsSuccess)
|
if (!transferFilesResult.IsSuccess)
|
||||||
@@ -54,8 +53,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
var errorMessage = string.Join("; ", transferFilesResult.Errors);
|
var errorMessage = string.Join("; ", transferFilesResult.Errors);
|
||||||
logger.LogWarning("Failed to transfer files from {FolderPath} to bucket {DestinationBucketName}, key {DestinationKeyName}. Errors: {Errors}",
|
logger.LogWarning("Failed to transfer files from {FolderPath} to bucket {DestinationBucketName}, key {DestinationKeyName}. Errors: {Errors}",
|
||||||
folderPath,
|
folderPath,
|
||||||
executeContext.Arguments.DestinationBucketName,
|
executeContext.Arguments.DestinationBucket,
|
||||||
destinationKeyName,
|
destinationKey,
|
||||||
errorMessage);
|
errorMessage);
|
||||||
throw new Exception(errorMessage);
|
throw new Exception(errorMessage);
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
{
|
{
|
||||||
logger.LogError(exception, "Error transferring files from {FolderPath} to bucket {DestinationBucketName}",
|
logger.LogError(exception, "Error transferring files from {FolderPath} to bucket {DestinationBucketName}",
|
||||||
folderPath,
|
folderPath,
|
||||||
executeContext.Arguments.DestinationBucketName);
|
executeContext.Arguments.DestinationBucket);
|
||||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -80,7 +79,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
foreach (var uploadedKey in compensateContext.Log.UploadedKeys)
|
foreach (var uploadedKey in compensateContext.Log.UploadedKeys)
|
||||||
{
|
{
|
||||||
await storageHandler.RemoveFileAsync(
|
await storageHandler.RemoveFileAsync(
|
||||||
compensateContext.Log.DestinationBucketName,
|
compensateContext.Log.DestinationBucket,
|
||||||
uploadedKey,
|
uploadedKey,
|
||||||
compensateContext.CancellationToken);
|
compensateContext.CancellationToken);
|
||||||
}
|
}
|
||||||
@@ -89,7 +88,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "Error compensating transferred files to bucket {DestinationBucketName}", compensateContext.Log.DestinationBucketName);
|
logger.LogError(exception, "Error compensating transferred files to bucket {DestinationBucketName}", compensateContext.Log.DestinationBucket);
|
||||||
return compensateContext.Failed(exception);
|
return compensateContext.Failed(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.FilePathVariableName);
|
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.FilePathVariable);
|
||||||
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
||||||
var fileName = Path.GetFileName(sourceFilePath);
|
var fileName = Path.GetFileName(sourceFilePath);
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
{
|
{
|
||||||
var uploadResult = await storageHandler.UploadFileAsync(
|
var uploadResult = await storageHandler.UploadFileAsync(
|
||||||
sourceFilePath,
|
sourceFilePath,
|
||||||
executeContext.Arguments.DestinationBucketName,
|
executeContext.Arguments.DestinationBucket,
|
||||||
Path.Combine(executeContext.Arguments.DestinationRoute, fileName),
|
Path.Combine(executeContext.Arguments.DestinationRoute, fileName),
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
{
|
{
|
||||||
var errors = string.Join("; ", uploadResult.Errors);
|
var errors = string.Join("; ", uploadResult.Errors);
|
||||||
logger.LogWarning("Failed to upload file to bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
|
logger.LogWarning("Failed to upload file to bucket. Bucket: {BucketName}, Key: {KeyName}, Errors: {Errors}",
|
||||||
executeContext.Arguments.DestinationBucketName,
|
executeContext.Arguments.DestinationBucket,
|
||||||
executeContext.Arguments.DestinationRoute,
|
executeContext.Arguments.DestinationRoute,
|
||||||
errors);
|
errors);
|
||||||
throw new Exception(errors);
|
throw new Exception(errors);
|
||||||
@@ -55,7 +55,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
|
|
||||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||||
return executeContext.CompletedWithVariables(new UploadFileToBucketLog(
|
return executeContext.CompletedWithVariables(new UploadFileToBucketLog(
|
||||||
executeContext.Arguments.DestinationBucketName,
|
executeContext.Arguments.DestinationBucket,
|
||||||
executeContext.Arguments.DestinationRoute));
|
executeContext.Arguments.DestinationRoute));
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@@ -71,14 +71,14 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var uploadResult = await storageHandler.RemoveFileAsync(
|
var uploadResult = await storageHandler.RemoveFileAsync(
|
||||||
compensateContext.Log.DestinationBucketName,
|
compensateContext.Log.DestinationBucket,
|
||||||
compensateContext.Log.DestinationKeyName,
|
compensateContext.Log.DestinationKey,
|
||||||
compensateContext.CancellationToken);
|
compensateContext.CancellationToken);
|
||||||
|
|
||||||
if (!uploadResult.IsSuccess)
|
if (!uploadResult.IsSuccess)
|
||||||
{
|
{
|
||||||
var errors = string.Join("; ", uploadResult.Errors);
|
var errors = string.Join("; ", uploadResult.Errors);
|
||||||
var errorMessage = $"Failed to remove file from bucket during compensation. Bucket: {compensateContext.Log.DestinationBucketName}, Key: {compensateContext.Log.DestinationKeyName}, Errors: {errors}";
|
var errorMessage = $"Failed to remove file from bucket during compensation. Bucket: {compensateContext.Log.DestinationBucket}, Key: {compensateContext.Log.DestinationKey}, Errors: {errors}";
|
||||||
|
|
||||||
logger.LogError(errorMessage);
|
logger.LogError(errorMessage);
|
||||||
return compensateContext.Failed(new Exception(errorMessage));
|
return compensateContext.Failed(new Exception(errorMessage));
|
||||||
@@ -88,8 +88,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "An error occurred while compensating upload file to bucket activity for bucket {BucketName} and key {KeyName}",
|
logger.LogError(exception, "An error occurred while compensating upload file to bucket activity for bucket {BucketName} and key {KeyName}",
|
||||||
compensateContext.Log.DestinationBucketName,
|
compensateContext.Log.DestinationBucket,
|
||||||
compensateContext.Log.DestinationKeyName);
|
compensateContext.Log.DestinationKey);
|
||||||
return compensateContext.Failed(exception);
|
return compensateContext.Failed(exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, destinationFolderName);
|
var workingDirectory = Path.Combine(executeContext.Arguments.TemporaryRootDirectory, destinationFolderName);
|
||||||
|
|
||||||
var sourceFilePath = Path.Combine(
|
var sourceFilePath = Path.Combine(
|
||||||
workingDirectory, Guid.NewGuid().ToString() + Path.GetExtension(executeContext.Arguments.SourceKeyName));
|
workingDirectory, Guid.NewGuid().ToString() + Path.GetExtension(executeContext.Arguments.SourceKey));
|
||||||
var smallPictureFilePath = Path.Combine(
|
var smallPictureFilePath = Path.Combine(
|
||||||
workingDirectory, Guid.NewGuid().ToString() + ResizedPictureFileExtension);
|
workingDirectory, Guid.NewGuid().ToString() + ResizedPictureFileExtension);
|
||||||
var mediumPictureFilePath = Path.Combine(
|
var mediumPictureFilePath = Path.Combine(
|
||||||
@@ -65,7 +65,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
logger.LogError(exception, "Error generating picture workflow paths for key {SourceKeyName}",
|
logger.LogError(exception, "Error generating picture workflow paths for key {SourceKeyName}",
|
||||||
executeContext.Arguments.SourceKeyName);
|
executeContext.Arguments.SourceKey);
|
||||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.SourceFilePathVariableName);
|
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.SourceFilePathVariable);
|
||||||
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
ArgumentNullException.ThrowIfNull(sourceFilePath, nameof(sourceFilePath));
|
||||||
var destinationFilePath = executeContext.GetVariable<string>(executeContext.Arguments.DestinationFilePathVariableName);
|
var destinationFilePath = executeContext.GetVariable<string>(executeContext.Arguments.DestinationFilePathVariable);
|
||||||
ArgumentNullException.ThrowIfNull(destinationFilePath, nameof(destinationFilePath));
|
ArgumentNullException.ThrowIfNull(destinationFilePath, nameof(destinationFilePath));
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var smallResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.SmallPictureVariableName);
|
var smallResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.SmallPictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(smallResizedVariable, nameof(smallResizedVariable));
|
ArgumentNullException.ThrowIfNull(smallResizedVariable, nameof(smallResizedVariable));
|
||||||
var mediumResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.MediumPictureVariableName);
|
var mediumResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.MediumPictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(mediumResizedVariable, nameof(mediumResizedVariable));
|
ArgumentNullException.ThrowIfNull(mediumResizedVariable, nameof(mediumResizedVariable));
|
||||||
var largeResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.LargePictureVariableName);
|
var largeResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.LargePictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(largeResizedVariable, nameof(largeResizedVariable));
|
ArgumentNullException.ThrowIfNull(largeResizedVariable, nameof(largeResizedVariable));
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -58,7 +58,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
playList.MediumPictureKeyName,
|
playList.MediumPictureKeyName,
|
||||||
playList.LargePictureKeyName);
|
playList.LargePictureKeyName);
|
||||||
|
|
||||||
playList.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKeyName);
|
playList.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
|
||||||
playList.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
|
playList.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
|
||||||
playList.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
|
playList.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
|
||||||
playList.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
|
playList.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
|
||||||
@@ -94,10 +94,10 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
return compensateContext.Compensated();
|
return compensateContext.Compensated();
|
||||||
}
|
}
|
||||||
|
|
||||||
playList.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKeyName;
|
playList.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKey;
|
||||||
playList.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKeyName;
|
playList.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKey;
|
||||||
playList.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKeyName;
|
playList.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKey;
|
||||||
playList.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKeyName;
|
playList.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKey;
|
||||||
|
|
||||||
database.PlayLists.Update(playList);
|
database.PlayLists.Update(playList);
|
||||||
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
var smallResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.SmallPictureVariableName);
|
var smallResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.SmallPictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(smallResizedVariable, nameof(smallResizedVariable));
|
ArgumentNullException.ThrowIfNull(smallResizedVariable, nameof(smallResizedVariable));
|
||||||
var mediumResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.MediumPictureVariableName);
|
var mediumResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.MediumPictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(mediumResizedVariable, nameof(mediumResizedVariable));
|
ArgumentNullException.ThrowIfNull(mediumResizedVariable, nameof(mediumResizedVariable));
|
||||||
var largeResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.LargePictureVariableName);
|
var largeResizedVariable = executeContext.GetVariable<string>(executeContext.Arguments.LargePictureVariable);
|
||||||
ArgumentNullException.ThrowIfNull(largeResizedVariable, nameof(largeResizedVariable));
|
ArgumentNullException.ThrowIfNull(largeResizedVariable, nameof(largeResizedVariable));
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -58,7 +58,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
track.MediumPictureKeyName,
|
track.MediumPictureKeyName,
|
||||||
track.LargePictureKeyName);
|
track.LargePictureKeyName);
|
||||||
|
|
||||||
track.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKeyName);
|
track.OriginalPictureKeyName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
|
||||||
track.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
|
track.SmallPictureKeyName = Path.GetFileName(smallResizedVariable);
|
||||||
track.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
|
track.MediumPictureKeyName = Path.GetFileName(mediumResizedVariable);
|
||||||
track.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
|
track.LargePictureKeyName = Path.GetFileName(largeResizedVariable);
|
||||||
@@ -94,10 +94,10 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
return compensateContext.Compensated();
|
return compensateContext.Compensated();
|
||||||
}
|
}
|
||||||
|
|
||||||
track.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKeyName;
|
track.OriginalPictureKeyName = compensateContext.Log.PreviousOriginalPictureKey;
|
||||||
track.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKeyName;
|
track.SmallPictureKeyName = compensateContext.Log.PreviousSmallPictureKey;
|
||||||
track.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKeyName;
|
track.MediumPictureKeyName = compensateContext.Log.PreviousMediumPictureKey;
|
||||||
track.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKeyName;
|
track.LargePictureKeyName = compensateContext.Log.PreviousLargePictureKey;
|
||||||
|
|
||||||
database.Tracks.Update(track);
|
database.Tracks.Update(track);
|
||||||
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record DownloadFileFromBucketArguments(
|
public record DownloadFileFromBucketArguments(
|
||||||
string BucketName,
|
string Bucket,
|
||||||
string KeyName,
|
string Key,
|
||||||
string DestinationFilePathVariableName);
|
string DestinationFilePathVariable);
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,5 @@ namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
|||||||
{
|
{
|
||||||
public record GenerateAudioWorkflowPathsArguments(
|
public record GenerateAudioWorkflowPathsArguments(
|
||||||
string TemporaryRootDirectory,
|
string TemporaryRootDirectory,
|
||||||
string SourceKeyName);
|
string SourceKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
|||||||
{
|
{
|
||||||
public record GeneratePictureWorkflowPathsArguments(
|
public record GeneratePictureWorkflowPathsArguments(
|
||||||
string TemporaryRootDirectory,
|
string TemporaryRootDirectory,
|
||||||
string SourceKeyName);
|
string SourceKey);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record RemoveFileFromBucketArguments(
|
public record RemoveFileFromBucketArguments(
|
||||||
string BucketName,
|
string Bucket,
|
||||||
string KeyName);
|
string Key);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record ResizePictureLocalArguments(
|
public record ResizePictureLocalArguments(
|
||||||
string SourceFilePathVariableName,
|
string SourceFilePathVariable,
|
||||||
string DestinationFilePathVariableName,
|
string DestinationFilePathVariable,
|
||||||
int Width,
|
int Width,
|
||||||
int Height);
|
int Height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record TranscodeDashAudioArguments(
|
public record TranscodeDashAudioArguments(
|
||||||
string SourceFilePathVariableName,
|
string SourceFilePathVariable,
|
||||||
string WorkingDirectoryVariableName);
|
string WorkingDirectoryVariable);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
namespace Musify.Infrastructure.MassTransit.Activities.Arguments
|
||||||
{
|
{
|
||||||
public record TransferFilesToBucketArguments(
|
public record TransferFilesToBucketArguments(
|
||||||
string DestinationBucketName,
|
string DestinationBucket,
|
||||||
string SourceDirectoryVariableName,
|
string SourceDirectoryVariable,
|
||||||
string? DestinationKeyName = null,
|
string DestinationKey);
|
||||||
string? DestinationKeyNameVariableName = null);
|
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public record UpdatePlayListPictureArguments(
|
public record UpdatePlayListPictureArguments(
|
||||||
Guid PlayListId,
|
Guid PlayListId,
|
||||||
string OriginalPictureKeyName,
|
string OriginalPictureKey,
|
||||||
string SmallPictureVariableName,
|
string SmallPictureVariable,
|
||||||
string MediumPictureVariableName,
|
string MediumPictureVariable,
|
||||||
string LargePictureVariableName);
|
string LargePictureVariable);
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,5 @@
|
|||||||
{
|
{
|
||||||
public record UpdateTrackAudioArguments(
|
public record UpdateTrackAudioArguments(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string AudioFolderKeyName);
|
string AudioFolderKey);
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public record UpdateTrackPictureArguments(
|
public record UpdateTrackPictureArguments(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string OriginalPictureKeyName,
|
string OriginalPictureKey,
|
||||||
string SmallPictureVariableName,
|
string SmallPictureVariable,
|
||||||
string MediumPictureVariableName,
|
string MediumPictureVariable,
|
||||||
string LargePictureVariableName);
|
string LargePictureVariable);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Arguments
|
namespace Musify.Infrastructure.MassTransit.Arguments
|
||||||
{
|
{
|
||||||
public record UploadFileToBucketArguments(
|
public record UploadFileToBucketArguments(
|
||||||
string FilePathVariableName,
|
string FilePathVariable,
|
||||||
string DestinationBucketName,
|
string DestinationBucket,
|
||||||
string DestinationRoute);
|
string DestinationRoute);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using MassTransit;
|
using MassTransit;
|
||||||
using MassTransit.Courier.Contracts;
|
using MassTransit.Courier.Contracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Musify.Infrastructure.MassTransit;
|
|
||||||
|
|
||||||
namespace Musify.Infrastructure.MassTransit.Consumers
|
namespace Musify.Infrastructure.MassTransit.Consumers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,29 +65,19 @@ namespace Musify.Infrastructure.MassTransit
|
|||||||
busFactoryConfigurator.UseConsumeFilter(typeof(ProcessTrackingConsumeFilter<>), busRegistrationContext);
|
busFactoryConfigurator.UseConsumeFilter(typeof(ProcessTrackingConsumeFilter<>), busRegistrationContext);
|
||||||
|
|
||||||
busFactoryConfigurator.ReceiveEndpoint(UpdatePlayListPictureConsumer.QueueName, endpointConfigurator =>
|
busFactoryConfigurator.ReceiveEndpoint(UpdatePlayListPictureConsumer.QueueName, endpointConfigurator =>
|
||||||
{
|
endpointConfigurator.ConfigureConsumer<UpdatePlayListPictureConsumer>(busRegistrationContext));
|
||||||
endpointConfigurator.ConfigureConsumer<UpdatePlayListPictureConsumer>(busRegistrationContext);
|
|
||||||
} );
|
|
||||||
|
|
||||||
busFactoryConfigurator.ReceiveEndpoint(RemoveFileConsumer.QueueName, endpointConfigurator =>
|
busFactoryConfigurator.ReceiveEndpoint(RemoveFileConsumer.QueueName, endpointConfigurator =>
|
||||||
{
|
endpointConfigurator.ConfigureConsumer<RemoveFileConsumer>(busRegistrationContext));
|
||||||
endpointConfigurator.ConfigureConsumer<RemoveFileConsumer>(busRegistrationContext);
|
|
||||||
} );
|
|
||||||
|
|
||||||
busFactoryConfigurator.ReceiveEndpoint(UpdateTrackAudioConsumer.QueueName, endpointConfigurator =>
|
busFactoryConfigurator.ReceiveEndpoint(UpdateTrackAudioConsumer.QueueName, endpointConfigurator =>
|
||||||
{
|
endpointConfigurator.ConfigureConsumer<UpdateTrackAudioConsumer>(busRegistrationContext));
|
||||||
endpointConfigurator.ConfigureConsumer<UpdateTrackAudioConsumer>(busRegistrationContext);
|
|
||||||
} );
|
|
||||||
|
|
||||||
busFactoryConfigurator.ReceiveEndpoint(UpdateTrackPictureConsumer.QueueName, endpointConfigurator =>
|
busFactoryConfigurator.ReceiveEndpoint(UpdateTrackPictureConsumer.QueueName, endpointConfigurator =>
|
||||||
{
|
endpointConfigurator.ConfigureConsumer<UpdateTrackPictureConsumer>(busRegistrationContext));
|
||||||
endpointConfigurator.ConfigureConsumer<UpdateTrackPictureConsumer>(busRegistrationContext);
|
|
||||||
} );
|
|
||||||
|
|
||||||
busFactoryConfigurator.ReceiveEndpoint(RoutingSlipCleanUpConsumer.QueueName, endpointConfigurator =>
|
busFactoryConfigurator.ReceiveEndpoint(RoutingSlipCleanUpConsumer.QueueName, endpointConfigurator =>
|
||||||
{
|
endpointConfigurator.ConfigureConsumer<RoutingSlipCleanUpConsumer>(busRegistrationContext));
|
||||||
endpointConfigurator.ConfigureConsumer<RoutingSlipCleanUpConsumer>(busRegistrationContext);
|
|
||||||
} );
|
|
||||||
|
|
||||||
ConfigureExecuteActivityEndpoint<RemoveFileFromBucketActivity, RemoveFileFromBucketArguments>(
|
ConfigureExecuteActivityEndpoint<RemoveFileFromBucketActivity, RemoveFileFromBucketArguments>(
|
||||||
busFactoryConfigurator,
|
busFactoryConfigurator,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Musify.Infrastructure.MassTransit.Filters
|
|||||||
|
|
||||||
public void Probe(ProbeContext context)
|
public void Probe(ProbeContext context)
|
||||||
{
|
{
|
||||||
context.CreateFilterScope(nameof(ProcessTrackingConsumeFilter<TMessage>));
|
context.CreateFilterScope(nameof(ProcessTrackingConsumeFilter<>));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
||||||
{
|
{
|
||||||
public record DownloadFileFromBucketLog(
|
public record DownloadFileFromBucketLog(
|
||||||
string BucketName,
|
string Bucket,
|
||||||
string KeyName,
|
string Key,
|
||||||
string DestinationFilePath);
|
string DestinationFilePath);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
||||||
{
|
{
|
||||||
public record TransferFilesToBucketLog(string DestinationBucketName, string[] UploadedKeys);
|
public record TransferFilesToBucketLog(string DestinationBucket, string[] UploadedKeys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
|||||||
{
|
{
|
||||||
public record UpdatePlayListPictureLog(
|
public record UpdatePlayListPictureLog(
|
||||||
Guid PlayListId,
|
Guid PlayListId,
|
||||||
string PreviousOriginalPictureKeyName,
|
string PreviousOriginalPictureKey,
|
||||||
string PreviousSmallPictureKeyName,
|
string PreviousSmallPictureKey,
|
||||||
string PreviousMediumPictureKeyName,
|
string PreviousMediumPictureKey,
|
||||||
string PreviousLargePictureKeyName);
|
string PreviousLargePictureKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Logs
|
namespace Musify.Infrastructure.MassTransit.Logs
|
||||||
{
|
{
|
||||||
public record UpdateTrackAudioLog(Guid TrackId,
|
public record UpdateTrackAudioLog(
|
||||||
string PreviousFolderAudioKeyName);
|
Guid TrackId,
|
||||||
|
string PreviousFolderAudioKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Logs
|
|||||||
{
|
{
|
||||||
public record UpdateTrackPictureLog(
|
public record UpdateTrackPictureLog(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string PreviousOriginalPictureKeyName,
|
string PreviousOriginalPictureKey,
|
||||||
string PreviousSmallPictureKeyName,
|
string PreviousSmallPictureKey,
|
||||||
string PreviousMediumPictureKeyName,
|
string PreviousMediumPictureKey,
|
||||||
string PreviousLargePictureKeyName);
|
string PreviousLargePictureKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Logs
|
namespace Musify.Infrastructure.MassTransit.Logs
|
||||||
{
|
{
|
||||||
public record UploadFileToBucketLog(string DestinationBucketName, string DestinationKeyName);
|
public record UploadFileToBucketLog(string DestinationBucket, string DestinationKey);
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,6 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
public RoutingSlipBuilder Build(UpdateTrackAudioEvent message, Guid? correlationId)
|
public RoutingSlipBuilder Build(UpdateTrackAudioEvent message, Guid? correlationId)
|
||||||
{
|
{
|
||||||
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
||||||
|
|
||||||
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
||||||
|
|
||||||
routingSlipBuilder.AddSubscription(
|
routingSlipBuilder.AddSubscription(
|
||||||
@@ -27,14 +26,14 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
EndpointHelper.BuildExecuteActivityUri(GenerateAudioWorkflowPathsActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(GenerateAudioWorkflowPathsActivity.ExecuteEndpointName),
|
||||||
new GenerateAudioWorkflowPathsArguments(
|
new GenerateAudioWorkflowPathsArguments(
|
||||||
workerConfiguration.Routes.TemporaryFilesDirectory,
|
workerConfiguration.Routes.TemporaryFilesDirectory,
|
||||||
message.SourceKeyName));
|
message.SourceKey));
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
ActivityNames.DownloadFile,
|
ActivityNames.DownloadFile,
|
||||||
EndpointHelper.BuildExecuteActivityUri(DownloadFileFromBucketActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(DownloadFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new DownloadFileFromBucketArguments(
|
new DownloadFileFromBucketArguments(
|
||||||
message.SourceBucketName,
|
message.SourceBucket,
|
||||||
message.SourceKeyName,
|
message.SourceKey,
|
||||||
RoutingSlipVariableNames.Audio.SourceFilePath));
|
RoutingSlipVariableNames.Audio.SourceFilePath));
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
@@ -48,16 +47,16 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
ActivityNames.TransferFiles,
|
ActivityNames.TransferFiles,
|
||||||
EndpointHelper.BuildExecuteActivityUri(TransferFilesToBucketActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(TransferFilesToBucketActivity.ExecuteEndpointName),
|
||||||
new TransferFilesToBucketArguments(
|
new TransferFilesToBucketArguments(
|
||||||
message.DestinationBucketName,
|
message.DestinationBucket,
|
||||||
RoutingSlipVariableNames.Audio.TranscodedDirectory,
|
RoutingSlipVariableNames.Audio.TranscodedDirectory,
|
||||||
message.DestinationFolderKeyName));
|
message.DestinationFolderKey));
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
ActivityNames.UpdateTrackAudio,
|
ActivityNames.UpdateTrackAudio,
|
||||||
EndpointHelper.BuildExecuteActivityUri(UpdateTrackAudioActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(UpdateTrackAudioActivity.ExecuteEndpointName),
|
||||||
new UpdateTrackAudioArguments(
|
new UpdateTrackAudioArguments(
|
||||||
message.TrackId,
|
message.TrackId,
|
||||||
message.DestinationFolderKeyName));
|
message.DestinationFolderKey));
|
||||||
|
|
||||||
return routingSlipBuilder;
|
return routingSlipBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-58
@@ -15,17 +15,11 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
public RoutingSlipBuilder Build(UpdateTrackPictureEvent message, Guid? correlationId)
|
public RoutingSlipBuilder Build(UpdateTrackPictureEvent message, Guid? correlationId)
|
||||||
{
|
{
|
||||||
var routingSlipBuilder = BuildPictureWorkflow(
|
var routingSlipBuilder = BuildPictureWorkflow(
|
||||||
message.SourceBucketName,
|
message.Bucket,
|
||||||
message.SourceKeyName,
|
message.SourceKey,
|
||||||
message.SmallPictureRoute,
|
message.Small,
|
||||||
message.SmallPictureWidth,
|
message.Medium,
|
||||||
message.SmallPictureHeight,
|
message.Large,
|
||||||
message.MediumPictureRoute,
|
|
||||||
message.MediumPictureWidth,
|
|
||||||
message.MediumPictureHeight,
|
|
||||||
message.LargePictureRoute,
|
|
||||||
message.LargePictureWidth,
|
|
||||||
message.LargePictureHeight,
|
|
||||||
correlationId);
|
correlationId);
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
@@ -33,7 +27,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
EndpointHelper.BuildExecuteActivityUri(UpdateTrackPictureActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(UpdateTrackPictureActivity.ExecuteEndpointName),
|
||||||
new UpdateTrackPictureArguments(
|
new UpdateTrackPictureArguments(
|
||||||
message.TrackId,
|
message.TrackId,
|
||||||
message.SourceKeyName,
|
message.SourceKey,
|
||||||
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
||||||
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
||||||
RoutingSlipVariableNames.Picture.LargeResizedFilePath));
|
RoutingSlipVariableNames.Picture.LargeResizedFilePath));
|
||||||
@@ -44,17 +38,11 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
public RoutingSlipBuilder Build(UpdatePlayListPictureEvent message, Guid? correlationId)
|
public RoutingSlipBuilder Build(UpdatePlayListPictureEvent message, Guid? correlationId)
|
||||||
{
|
{
|
||||||
var routingSlipBuilder = BuildPictureWorkflow(
|
var routingSlipBuilder = BuildPictureWorkflow(
|
||||||
message.SourceBucketName,
|
message.Bucket,
|
||||||
message.SourceKeyName,
|
message.SourceKey,
|
||||||
message.SmallPictureRoute,
|
message.Small,
|
||||||
message.SmallPictureWidth,
|
message.Medium,
|
||||||
message.SmallPictureHeight,
|
message.Large,
|
||||||
message.MediumPictureRoute,
|
|
||||||
message.MediumPictureWidth,
|
|
||||||
message.MediumPictureHeight,
|
|
||||||
message.LargePictureRoute,
|
|
||||||
message.LargePictureWidth,
|
|
||||||
message.LargePictureHeight,
|
|
||||||
correlationId);
|
correlationId);
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
@@ -62,7 +50,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
EndpointHelper.BuildExecuteActivityUri(UpdatePlayListPictureActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(UpdatePlayListPictureActivity.ExecuteEndpointName),
|
||||||
new UpdatePlayListPictureArguments(
|
new UpdatePlayListPictureArguments(
|
||||||
message.PlayListId,
|
message.PlayListId,
|
||||||
message.SourceKeyName,
|
message.SourceKey,
|
||||||
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
||||||
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
||||||
RoutingSlipVariableNames.Picture.LargeResizedFilePath));
|
RoutingSlipVariableNames.Picture.LargeResizedFilePath));
|
||||||
@@ -71,71 +59,58 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
}
|
}
|
||||||
|
|
||||||
RoutingSlipBuilder BuildPictureWorkflow(
|
RoutingSlipBuilder BuildPictureWorkflow(
|
||||||
string bucketName,
|
string bucket,
|
||||||
string sourceKeyName,
|
string sourceKey,
|
||||||
string destinationSmallPictureRoute,
|
ImageSize small,
|
||||||
int smallPictureWidth,
|
ImageSize medium,
|
||||||
int smallPictureHeight,
|
ImageSize large,
|
||||||
string destinationMediumPictureRoute,
|
|
||||||
int mediumPictureWidth,
|
|
||||||
int mediumPictureHeight,
|
|
||||||
string destinationLargePictureRoute,
|
|
||||||
int largePictureWidth,
|
|
||||||
int largePictureHeight,
|
|
||||||
Guid? correlationId)
|
Guid? correlationId)
|
||||||
{
|
{
|
||||||
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
||||||
|
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
||||||
|
|
||||||
routingSlipBuilder.AddSubscription(
|
routingSlipBuilder.AddSubscription(
|
||||||
EndpointHelper.BuildConsumerUri(RoutingSlipCleanUpConsumer.QueueName),
|
EndpointHelper.BuildConsumerUri(RoutingSlipCleanUpConsumer.QueueName),
|
||||||
RoutingSlipEvents.Completed | RoutingSlipEvents.Faulted);
|
RoutingSlipEvents.Completed | RoutingSlipEvents.Faulted);
|
||||||
|
|
||||||
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
ActivityNames.GeneratePictureWorkflowPaths,
|
ActivityNames.GeneratePictureWorkflowPaths,
|
||||||
EndpointHelper.BuildExecuteActivityUri(GeneratePictureWorkflowPathsActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(GeneratePictureWorkflowPathsActivity.ExecuteEndpointName),
|
||||||
new GeneratePictureWorkflowPathsArguments(
|
new GeneratePictureWorkflowPathsArguments(
|
||||||
workerConfiguration.Routes.TemporaryFilesDirectory,
|
workerConfiguration.Routes.TemporaryFilesDirectory,
|
||||||
sourceKeyName));
|
sourceKey));
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
ActivityNames.DownloadFile,
|
ActivityNames.DownloadFile,
|
||||||
EndpointHelper.BuildExecuteActivityUri(DownloadFileFromBucketActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(DownloadFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new DownloadFileFromBucketArguments(
|
new DownloadFileFromBucketArguments(
|
||||||
bucketName,
|
bucket,
|
||||||
sourceKeyName,
|
sourceKey,
|
||||||
RoutingSlipVariableNames.Picture.OriginalFilePath));
|
RoutingSlipVariableNames.Picture.OriginalFilePath));
|
||||||
|
|
||||||
AddResizeActivity(
|
AddResizeActivity(
|
||||||
routingSlipBuilder,
|
routingSlipBuilder,
|
||||||
ActivityNames.ResizeSmall,
|
ActivityNames.ResizeSmall,
|
||||||
ActivityNames.UploadSmall,
|
ActivityNames.UploadSmall,
|
||||||
bucketName,
|
bucket,
|
||||||
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
RoutingSlipVariableNames.Picture.SmallResizedFilePath,
|
||||||
destinationSmallPictureRoute,
|
small);
|
||||||
smallPictureWidth,
|
|
||||||
smallPictureHeight);
|
|
||||||
|
|
||||||
AddResizeActivity(
|
AddResizeActivity(
|
||||||
routingSlipBuilder,
|
routingSlipBuilder,
|
||||||
ActivityNames.ResizeMedium,
|
ActivityNames.ResizeMedium,
|
||||||
ActivityNames.ResizeMedium,
|
ActivityNames.ResizeMedium,
|
||||||
bucketName,
|
bucket,
|
||||||
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
RoutingSlipVariableNames.Picture.MediumResizedFilePath,
|
||||||
destinationMediumPictureRoute,
|
medium);
|
||||||
mediumPictureWidth,
|
|
||||||
mediumPictureHeight);
|
|
||||||
|
|
||||||
AddResizeActivity(
|
AddResizeActivity(
|
||||||
routingSlipBuilder,
|
routingSlipBuilder,
|
||||||
ActivityNames.ResizeLarge,
|
ActivityNames.ResizeLarge,
|
||||||
ActivityNames.UploadLarge,
|
ActivityNames.UploadLarge,
|
||||||
bucketName,
|
bucket,
|
||||||
RoutingSlipVariableNames.Picture.LargeResizedFilePath,
|
RoutingSlipVariableNames.Picture.LargeResizedFilePath,
|
||||||
destinationLargePictureRoute,
|
large);
|
||||||
largePictureWidth,
|
|
||||||
largePictureHeight);
|
|
||||||
|
|
||||||
return routingSlipBuilder;
|
return routingSlipBuilder;
|
||||||
}
|
}
|
||||||
@@ -146,9 +121,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
string uploadActivityName,
|
string uploadActivityName,
|
||||||
string bucketName,
|
string bucketName,
|
||||||
string destinationFilePathVariableName,
|
string destinationFilePathVariableName,
|
||||||
string destinationBucketRoute,
|
ImageSize imageSize)
|
||||||
int width,
|
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
resizeActivityName,
|
resizeActivityName,
|
||||||
@@ -156,8 +129,8 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
new ResizePictureLocalArguments(
|
new ResizePictureLocalArguments(
|
||||||
RoutingSlipVariableNames.Picture.OriginalFilePath,
|
RoutingSlipVariableNames.Picture.OriginalFilePath,
|
||||||
destinationFilePathVariableName,
|
destinationFilePathVariableName,
|
||||||
width,
|
imageSize.Width,
|
||||||
height));
|
imageSize.Height));
|
||||||
|
|
||||||
routingSlipBuilder.AddActivity(
|
routingSlipBuilder.AddActivity(
|
||||||
uploadActivityName,
|
uploadActivityName,
|
||||||
@@ -165,7 +138,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
new UploadFileToBucketArguments(
|
new UploadFileToBucketArguments(
|
||||||
destinationFilePathVariableName,
|
destinationFilePathVariableName,
|
||||||
bucketName,
|
bucketName,
|
||||||
destinationBucketRoute));
|
imageSize.SavePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-3
@@ -12,7 +12,6 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
public RoutingSlipBuilder Build(RemoveFileEvent message, Guid? correlationId)
|
public RoutingSlipBuilder Build(RemoveFileEvent message, Guid? correlationId)
|
||||||
{
|
{
|
||||||
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
var routingSlipBuilder = new RoutingSlipBuilder(NewId.NextGuid());
|
||||||
|
|
||||||
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
routingSlipBuilder.AddVariable(RoutingSlipVariableNames.Workflow.CorrelationId, correlationId ?? Guid.Empty);
|
||||||
|
|
||||||
routingSlipBuilder.AddSubscription(
|
routingSlipBuilder.AddSubscription(
|
||||||
@@ -23,8 +22,8 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
ActivityNames.RemoveFile,
|
ActivityNames.RemoveFile,
|
||||||
EndpointHelper.BuildExecuteActivityUri(RemoveFileFromBucketActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(RemoveFileFromBucketActivity.ExecuteEndpointName),
|
||||||
new RemoveFileFromBucketArguments(
|
new RemoveFileFromBucketArguments(
|
||||||
message.BucketName,
|
message.Bucket,
|
||||||
message.KeyName));
|
message.Key));
|
||||||
|
|
||||||
return routingSlipBuilder;
|
return routingSlipBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user