Use variable
This commit is contained in:
@@ -30,9 +30,13 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
|||||||
0,
|
0,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
|
||||||
|
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.FilePathVariableName);
|
||||||
|
if (string.IsNullOrEmpty(sourceFilePath))
|
||||||
|
throw new InvalidOperationException($"Upload activity requires variable '{executeContext.Arguments.FilePathVariableName}' with source file path.");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var fileStream = File.OpenRead(executeContext.Arguments.SourceFilePath);
|
using var fileStream = File.OpenRead(sourceFilePath);
|
||||||
|
|
||||||
var uploadResult = await storageHandler.UploadFileAsync(
|
var uploadResult = await storageHandler.UploadFileAsync(
|
||||||
fileStream,
|
fileStream,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Musify.Infrastructure.MassTransit.Arguments
|
namespace Musify.Infrastructure.MassTransit.Arguments
|
||||||
{
|
{
|
||||||
public record UploadFileToBucketArguments(
|
public record UploadFileToBucketArguments(
|
||||||
string SourceFilePath,
|
string FilePathVariableName,
|
||||||
string ContentType,
|
string ContentType,
|
||||||
string DestinationBucketName,
|
string DestinationBucketName,
|
||||||
string DestinationKeyName);
|
string DestinationKeyName);
|
||||||
|
|||||||
Reference in New Issue
Block a user