public FileProcessor(IFileDataModel fileDataModel, IFileUploadHelper fileUploadHelper, IApplicationConfig applicationConfig, IFileUploadHub fileUploadHub)
 {
     this._fileDataModel     = fileDataModel;
     this._fileUploadHelper  = fileUploadHelper;
     this._applicationConfig = applicationConfig;
     this._fileUploadHub     = fileUploadHub;
 }
 public FileController(IFileDataModel fileDataModel, ILogger logger, IMessageQueueHelper messageQueueHelper, IApplicationConfig applicationConfig, IFileUploadHelper fileUploadHelper, IGenericHelper genericHelper)
 {
     this._fileDataModel      = fileDataModel;
     this._logger             = logger;
     this._messageQueueHelper = messageQueueHelper;
     this._applicationConfig  = applicationConfig;
     this._fileUploadHelper   = fileUploadHelper;
     this._genericHelper      = genericHelper;
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting APP");

            #region DI Container Builder
            var builder = new ContainerBuilder();

            builder.RegisterType <RedisHelper>().As <ICacheHelper>();
            builder.RegisterType <ApplicationConfig>().As <IApplicationConfig>();
            builder.RegisterType <RabbitMQHelper>().As <IMessageQueueHelper>();
            builder.RegisterType <FileDataModel>().As <IFileDataModel>();
            builder.RegisterType <Log4NetHelper>().As <ILogger>();
            builder.RegisterType <AzureBlobStorageHelper>().As <IFileUploadHelper>();
            builder.RegisterType <FileUploadHub>().As <IFileUploadHub>();

            var container = builder.Build();
            #endregion

            using (var scope = container.BeginLifetimeScope())
            {
                #region DI Resolver
                _logger             = scope.Resolve <ILogger>();
                _cacheHelper        = scope.Resolve <ICacheHelper>();
                _messageQueueHelper = scope.Resolve <IMessageQueueHelper>();
                _applicationConfig  = scope.Resolve <IApplicationConfig>();
                _fileDataModel      = scope.Resolve <IFileDataModel>();
                _fileUploadHelper   = scope.Resolve <IFileUploadHelper>();
                _fileUploadHub      = scope.Resolve <IFileUploadHub>();
                #endregion

                var fileProcessor   = new FileProcessor(_fileDataModel, _fileUploadHelper, _applicationConfig, _fileUploadHub);
                var webserverHelper = new WebServerHelper(_applicationConfig);

                #region Processors
                Task.Run(() => _messageQueueHelper.ReadMessages <QueueFileMetaDataModel>(_applicationConfig, fileProcessor.FilePushed, _applicationConfig.FileDataCreateQueue));
                Task.Run(() => _messageQueueHelper.ReadMessages <QueueFileMetaDataModel>(_applicationConfig, fileProcessor.FileDelete, _applicationConfig.FileMetaDeleteQueue));
                Task.Run(() => _messageQueueHelper.ReadMessages <QueueFileMetaDataModel>(_applicationConfig, fileProcessor.FileOpened, _applicationConfig.FileOpenedQueue));
                #endregion

                Task.Run(() => webserverHelper.StartWebServer());
            }

            Console.ReadLine();
        }