예제 #1
0
        /// <summary>
        /// Retry a stage of the publishing workflow
        /// </summary>
        /// <remarks>
        /// This results in the Publisher updating the latest ReleaseStatus for this Release rather than creating a new one.
        /// </remarks>
        /// <param name="releaseId"></param>
        /// <param name="stage"></param>
        /// <returns></returns>
        public async Task <Either <ActionResult, Unit> > RetryReleaseStage(Guid releaseId, RetryStage stage)
        {
            return(await _persistenceHelper
                   .CheckEntityExists <Release>(releaseId)
                   .OnSuccess(release => _userService.CheckCanPublishRelease(release))
                   .OnSuccess(async release =>
            {
                if (release.Status != ReleaseStatus.Approved)
                {
                    return ValidationActionResult(ReleaseNotApproved);
                }

                await _storageQueueService.AddMessageAsync(
                    RetryStageQueue, new RetryStageMessage(releaseId, stage));

                _logger.LogTrace($"Sent retry stage message for Release: {releaseId}");
                return new Either <ActionResult, Unit>(Unit.Instance);
            }));
        }
예제 #2
0
 public RetryStageMessage(Guid releaseId, RetryStage stage)
 {
     ReleaseId = releaseId;
     Stage     = stage;
 }