예제 #1
0
        protected override async Task ExecuteAsync(CancellationToken token = default)
        {
            BuildEmailSendPipeline();
            RunningTask = SendEmailPipeline.StartAsync(false, token);

            while (!token.IsCancellationRequested)
            {
                if (RunningTask.IsCompleted && !RunningTask.IsFaulted)
                {
                    BuildEmailSendPipeline();
                    RunningTask = SendEmailPipeline.StartAsync(false, token);
                }
                else if (RunningTask.IsFaulted)
                {
                    if (RunningTask.Exception is not null)
                    {
                        var ex = RunningTask.Exception.Flatten().InnerException;
                        _logger.LogError("Error in excution.", ex);
                    }
                }

                await Task.Delay(1000, token).ConfigureAwait(false);
            }

            await _rabbitService.ShutdownAsync(false);
        }
예제 #2
0
 private async Task StartPipelinesAsync()
 {
     await SendEmailPipeline.StartAsync(false).ConfigureAwait(false);
 }