Beispiel #1
0
 public QpScheduler(IUnityContainer unityContainer, PrtgErrorsHandler prtgLogger, List <QaConfigCustomer> customers, TimeSpan tasksQueueCheckShiftTime)
 {
     _unityContainer           = unityContainer;
     _customers                = customers;
     _tasksQueueCheckShiftTime = tasksQueueCheckShiftTime;
     _prtgLogger               = prtgLogger;
 }
        private void RegisterInterfaceNotificationsProcessor(string serviceConfigName)
        {
            var nlogConfigName = $"NLog.{serviceConfigName}.config";

            Container.RegisterProcessor <InterfaceNotificationProcessor>(ServiceName, serviceConfigName);
            Container.RegisterType <IPrtgNLogFactory>(nlogConfigName, new ContainerControlledLifetimeManager(), new InjectionFactory(container => GetLoggerFactory(GetAbsolutePath(nlogConfigName))));
            Container.RegisterType <IExternalInterfaceNotificationService, ExternalInterfaceNotificationService>(serviceConfigName, new ContainerControlledLifetimeManager());

            var assemblyType      = typeof(InterfaceNotificationProcessor);
            var logger            = Container.Resolve <IPrtgNLogFactory>(nlogConfigName).GetLogger(assemblyType);
            var prtgErrorsHandler = new PrtgErrorsHandler(Container.Resolve <IPrtgNLogFactory>(nlogConfigName));

            Container.RegisterType <InterfaceNotificationProcessor>(
                assemblyType.Name,
                new TransientLifetimeManager(),
                new InjectionFactory(c => new InterfaceNotificationProcessor(
                                         logger,
                                         prtgErrorsHandler,
                                         c.Resolve <ISchedulerCustomerCollection>(),
                                         c.Resolve <IExternalInterfaceNotificationService>(serviceConfigName),
                                         c.Resolve <IInterfaceNotificationProvider>())
                                     ));

            RegisterInterfaceCleanupProcessor($"{serviceConfigName}.Cleanup");
        }
Beispiel #3
0
 public CheckNotificationQueueJob(PrtgErrorsHandler prtgLogger, IDbService dbService, IExternalSystemNotificationService systemNotificationService)
 {
     _prtgLogger = prtgLogger;
     _dbService  = dbService;
     _systemNotificationService = systemNotificationService;
     _cts = new CancellationTokenSource();
 }
Beispiel #4
0
 public CdcDataImportJob(PrtgErrorsHandler prtgLogger, ICdcImportService cdcImportService, ICdcDataImportProcessor cdcImportProcessor, IExternalSystemNotificationService systemNotificationService)
 {
     _prtgLogger                = prtgLogger;
     _cts                       = new CancellationTokenSource();
     _cdcImportService          = cdcImportService;
     _cdcImportProcessor        = cdcImportProcessor;
     _systemNotificationService = systemNotificationService;
 }
Beispiel #5
0
 public UsersProcessor(
     ILog logger,
     PrtgErrorsHandler prtgLogger,
     ISchedulerCustomerCollection schedulerCustomers,
     Func <IUserSynchronizationService> getSynchronizationService)
 {
     _logger                    = logger;
     _prtgLogger                = prtgLogger;
     _schedulerCustomers        = schedulerCustomers;
     _getSynchronizationService = getSynchronizationService;
 }
Beispiel #6
0
 public SystemCleanupProcessor(
     ILog logger,
     PrtgErrorsHandler prtgLogger,
     ISchedulerCustomerCollection schedulerCustomers,
     IExternalSystemNotificationService externalNotificationService)
 {
     _logger                      = logger;
     _prtgLogger                  = prtgLogger;
     _schedulerCustomers          = schedulerCustomers;
     _externalNotificationService = externalNotificationService;
 }
Beispiel #7
0
 public InterfaceNotificationProcessor(
     ILog logger,
     PrtgErrorsHandler prtgLogger,
     ISchedulerCustomerCollection schedulerCustomers,
     IExternalInterfaceNotificationService externalNotificationService,
     IInterfaceNotificationProvider notificationProvider)
 {
     _logger                      = logger;
     _prtgLogger                  = prtgLogger;
     _schedulerCustomers          = schedulerCustomers;
     _externalNotificationService = externalNotificationService;
     _notificationProvider        = notificationProvider;
 }
Beispiel #8
0
        private void RegisterUsersProcessor()
        {
            var nlogInjectionFactory = new InjectionFactory(container => GetLoggerFactory(GetAbsolutePath(UsersNlogConfigName)));

            Container.RegisterType <IPrtgNLogFactory>(UsersNlogConfigName, new ContainerControlledLifetimeManager(), nlogInjectionFactory);

            var assemblyType      = typeof(UsersProcessor);
            var logger            = Container.Resolve <IPrtgNLogFactory>(UsersNlogConfigName).GetLogger(assemblyType);
            var prtgErrorsHandler = new PrtgErrorsHandler(Container.Resolve <IPrtgNLogFactory>(UsersNlogConfigName));

            Container.RegisterType <IProcessor, UsersProcessor>(
                assemblyType.Name,
                new TransientLifetimeManager(),
                new InjectionFactory(c => new UsersProcessor(
                                         logger,
                                         prtgErrorsHandler,
                                         c.Resolve <ISchedulerCustomerCollection>(),
                                         c.Resolve <Func <IUserSynchronizationService> >())
                                     ));
        }
Beispiel #9
0
        public void Run()
        {
            var unityConfig = new UnityContainerCustomizer();
            var prtgLogger  = new PrtgErrorsHandler(unityConfig.UnityContainer.Resolve <IPrtgNLogFactory>());

            _cancellationTokenSource = new CancellationTokenSource();
            _task = new Task(() =>
            {
                do
                {
                    try
                    {
                        var customers = QPConfiguration.GetCustomers(AppName).Where(c => !c.ExcludeFromSchedulers).ToList();
                        new QpScheduler(unityConfig.UnityContainer, prtgLogger, customers, _tasksQueueCheckShiftTime).Run();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log.Error("There was an error while starting the service job", ex);
                    }
                } while (!_cancellationTokenSource.Token.WaitHandle.WaitOne(_recurrentTimeout));
            }, _cancellationTokenSource.Token, TaskCreationOptions.LongRunning);
            _task.Start();
        }