public bool Process(FileInfo fileInfo) { try { if (!_sftpClient.IsConnected) { _sftpClient.Connect(); } using (var fileStream = _fileProcessor.FileStream(fileInfo)) { var fileName = Path.GetFileName(fileInfo.FullName); _logger.DebugFormat("Starting to upload {0}", fileName); _sftpClient.UploadFile(fileStream, fileName); _logger.DebugFormat("Completed uploading {0}", fileName); } } catch (Exception ex) { _logger.Error("File upload failed!!!", ex); return(false); } return(true); }
public bool Process(FileInfo fileInfo) { using (var reader = _fileProcessor.FileStream(fileInfo)) { var message = new BrokeredMessage(reader) { ContentType = _configuration.ContentType }; _client.Send(message); } _logger.DebugFormat("Sent file: {0} to service bus: {1}", Path.GetFileName(fileInfo.FullName), _configuration.DestinationName); return(true); }