Exemple #1
0
        public async Task <PublishResponse> PublishAsync(PublishRequest request, string stateMachineArn, CancellationToken cancellationToken = default(CancellationToken))
        {
            var executionRequest = new StartExecutionRequest
            {
                Input           = JsonConvert.SerializeObject(request),
                Name            = request.GetExecutionName(),
                StateMachineArn = stateMachineArn
            };

            await StartExecutionAsync(request, executionRequest, cancellationToken);

            return(new PublishResponse
            {
                HttpStatusCode = HttpStatusCode.OK
            });
        }
Exemple #2
0
 private async Task StartExecutionAsync(PublishRequest request, StartExecutionRequest executionRequest, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (request.ShouldSuppressExecutionAlreadyExistsException())
     {
         try
         {
             await _stepFunctions.StartExecutionAsync(executionRequest, cancellationToken);
         }
         catch (ExecutionAlreadyExistsException ex)
         {
             Console.WriteLine($"ExecutionAlreadyExistsException error for {request.GetExecutionName()}. Exception was: {ex.Message}");
         }
     }
     else
     {
         await _stepFunctions.StartExecutionAsync(executionRequest, cancellationToken);
     }
 }