Esempio n. 1
0
        internal HeartbeatConfiguration(LiteServerConfiguration liteServer, InternalConfiguration configuration)
        {
            if (liteServer == null)
            {
                throw new ArgumentNullException(nameof(liteServer));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _providers     = new ScanAddRemoveInstaller <IHeartbeatProvider>();
            _configuration = configuration;

            LiteServer = liteServer;

            LiteServer.Application
            .Services(services => services
                      .Advanced(advanced => advanced
                                .Install(_providers)));

            // Add default providers
            AddProvider <CurrentProcessHeartbeatProvider>();
            AddProvider <GarbageCollectorHeartbeatProvider>();
        }
Esempio n. 2
0
        internal HangfireConfiguration(ApplicationConfiguration application)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }

            Application = application
                          .Hosts(hosts => hosts.Host <HangfireHost>());

            _configuration       = new InternalConfiguration();
            _backgroundProcesses = new ScanAddRemoveInstaller <IBackgroundProcess>();
        }
        internal LiteServerConfiguration(ApplicationConfiguration application)
        {
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }

            _servers = new ScanAddRemoveInstaller <IBackgroundServer>(configure: x => x.LifeStyle.Is(LifestyleType.Transient));
            _workers = new ScanAddRemoveInstaller <IBackgroundWorker>(configure: x => x.LifeStyle.Is(LifestyleType.Transient));

            Application = application
                          .Hosts(hosts => hosts.Host <LiteServerHost>())
                          .Services(services => services
                                    .Advanced(advanced => advanced
                                              .Install(_servers)
                                              .Install(_workers)));

            _configuration = new InternalConfiguration();
            _houseKeeping  = new HouseKeepingConfiguration(this, _configuration);
        }
Esempio n. 4
0
        internal ConcurrentTaskExecutionConfiguration(TasksConfiguration tasks)
        {
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            _evaluators             = new ScanAddRemoveInstaller <IPreventConcurrentTaskExecutionRuntimeEvaluator>(serviceDescriptor: x => x.Self());
            _customLockNames        = new ScanAddRemoveInstaller <IPreventConcurrentTaskExecutionCustomLockName>(serviceDescriptor: x => x.Self());
            _customLockDescriptions = new ScanAddRemoveInstaller <IPreventConcurrentTaskExecutionCustomLockDescription>(serviceDescriptor: x => x.Self());
            _exceptionHandlers      = new ScanAddRemoveInstaller <IPreventConcurrentTaskExecutionExceptionHandler>(serviceDescriptor: x => x.Self());

            // scan own assembly
            AddFromAssemblyOfThis <ConcurrentTaskExecutionConfiguration>();

            Tasks = tasks.Change(t => t.Application
                                 .Services(services => services
                                           .Advanced(advanced => advanced
                                                     .Install(_evaluators)
                                                     .Install(_customLockNames)
                                                     .Install(_customLockDescriptions)
                                                     .Install(_exceptionHandlers))));
        }