static void Main(string[] args) { FileReaderConfigurator fileReaderConfigurator = new FileReaderConfigurator(); FileReaderConfig fileReaderConfig = fileReaderConfigurator.ReadConfig(); //_notifier = new HttpNotifier(fileReaderConfig.NotificationTarget); _fileReadNotifier = new KafkaNotifier(fileReaderConfig.KafkaServerAddress, fileReaderConfig.FileReadTopicName); _fileContentNotifier = new KafkaNotifier(fileReaderConfig.KafkaServerAddress, fileReaderConfig.FileContentTopicName); IFileHandler fileHandler = new FileHandlerImplementation(fileReaderConfig.ProcessedLocation); IFileReader fileReader = new PoorMansFileReader(fileReaderConfig.InputLocation, fileHandler); //IReadHandler readHandler = new SendAndDeleteHandler(_fileReadNotifier); Console.WriteLine($"{fileReaderConfig.ProcessedLocation}"); IReadHandler readHandler = new SendAndMoveHandler(_fileReadNotifier, _fileContentNotifier, fileHandler); fileReader.FileRead += (fileReadEventArgs) => { readHandler.HandleReadFile(fileReadEventArgs.FileInfo); }; fileReader.Start(); }
public FileReaderConfig ReadConfig() { FileReaderConfig fileReaderConfig = new FileReaderConfig(); fileReaderConfig.InputLocation = _configValueGetter.GetConfigValue(InputLocation); fileReaderConfig.ProcessedLocation = _configValueGetter.GetConfigValue(ProcessedLocation); fileReaderConfig.NotificationTarget = _configValueGetter.GetConfigValue(NotificationTarget); fileReaderConfig.FileReadTopicName = _configValueGetter.GetConfigValue(FileReadTopicName); fileReaderConfig.FileContentTopicName = _configValueGetter.GetConfigValue(FileContentTopicName); fileReaderConfig.KafkaServerAddress = _configValueGetter.GetConfigValue(KafkaServerAddress); return(fileReaderConfig); }