Esempio n. 1
0
        private IEnumerable<IServerComponent> GetCommonComponents()
        {
            var performanceProcess = new DefaultJobPerformanceProcess(JobActivator.Current);
            var stateMachineFactory = new StateMachineFactory(_storage);

            for (var i = 0; i < _options.WorkerCount; i++)
            {
                var context = new WorkerContext(_serverId, _options.Queues, i + 1);
                yield return new Worker(context, _storage, performanceProcess, stateMachineFactory);
            }

            yield return new ServerHeartbeat(_storage, _serverId);
            yield return new SchedulePoller(_storage, stateMachineFactory, _options.SchedulePollingInterval);
            yield return new ServerWatchdog(_storage, _options.ServerWatchdogOptions);

            yield return new RecurringJobScheduler(
                _storage, 
                new BackgroundJobClient(_storage, stateMachineFactory),
                new ScheduleInstantFactory(),
				SchedulerResolution.Current.CreateThrottler());
        }
Esempio n. 2
0
        private IEnumerable<IServerSupervisor> GetCommonSupervisors()
        {
            var stateMachineFactory = new StateMachineFactory(_storage);
            var sharedWorkerContext = new SharedWorkerContext(
                _serverId,
                _options.Queues,
                _storage,
                new JobPerformanceProcess(),
                JobActivator.Current,
                stateMachineFactory);

            yield return new ServerSupervisor(new WorkerManager(sharedWorkerContext, _options.WorkerCount));
            yield return new ServerSupervisor(new ServerHeartbeat(_storage, _serverId));
            yield return new ServerSupervisor(new ServerWatchdog(_storage));

            yield return new ServerSupervisor(
                new SchedulePoller(_storage, stateMachineFactory, _options.SchedulePollingInterval));

            yield return new ServerSupervisor(
                new RecurringJobScheduler(
                    _storage, 
                    new BackgroundJobClient(_storage, stateMachineFactory),
                    new ScheduleInstantFactory(),
                    new EveryMinuteThrottler()));
        }