Esempio n. 1
0
        public override async Task Process()
        {
            try
            {
                var filesOnFtp = _dataFeedFileLoader.GetFilesWithFileExtensionPattern(Patterns).ToList();

                _newFiles = _fileChecker.GetNewFileList(filesOnFtp).ToList();

                await Task.WhenAll(_newFiles.Select(TaskUploadNewFile));

                if (_newFiles != null && _newFiles.Any())
                {
                    await _fileChecker.WriteNewFilesOnFileAsync(filesOnFtp);
                }

                await LogFileReading();

                _isUpdated = _savedFiles.Any();

                if (!_isUpdated)
                {
                    _logger.LogInformation("No new files on ftp was detected.");
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Exception occured, while executing FtpWatcherHandler");
                throw;
            }
        }