コード例 #1
0
 public BatchEngine(IBatchStore store, IDependencyResolver resolver, ILogger logger, BatchSettings batchSettings)
 {
     _store    = store;
     _logger   = logger;
     _settings = batchSettings ?? new BatchSettings();
     _resolver = resolver;
 }
コード例 #2
0
ファイル: BatchEngine.cs プロジェクト: jamesmh/Minion
 public BatchEngine(IBatchStore store, IDependencyResolver resolver = null, ILogger logger = null, BatchSettings batchSettings = null)
 {
     _store       = store;
     _jobExecutor = new DependencyInjectionJobExecutor(resolver);
     _logger      = logger;
     _settings    = batchSettings ?? new BatchSettings();
 }
コード例 #3
0
        public BatchEngine()
        {
            if (MinionConfiguration.Configuration.HeartBeatFrequency <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(MinionConfiguration.Configuration.HeartBeatFrequency),
                          "Heartbeat frequency must be more than 0");
            }
            if (MinionConfiguration.Configuration.NumberOfParallelJobs <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(MinionConfiguration.Configuration.NumberOfParallelJobs),
                          "Number of parallel jobs must be more than 0");
            }
            if (MinionConfiguration.Configuration.PollingFrequency <= 0)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(MinionConfiguration.Configuration.PollingFrequency),
                          "Polling frequency must be more than 0");
            }

            _store    = MinionConfiguration.Configuration.Store;
            _logger   = MinionConfiguration.Configuration.Logger;
            _settings = new BatchSettings
            {
                HeartBeatFrequency   = MinionConfiguration.Configuration.HeartBeatFrequency,
                NumberOfParallelJobs = MinionConfiguration.Configuration.NumberOfParallelJobs,
                PollingFrequency     = MinionConfiguration.Configuration.PollingFrequency,
            };
            _resolver = MinionConfiguration.Configuration.DependencyResolver;
        }
コード例 #4
0
        public void UseBatchStore(IBatchStore store)
        {
            Store = store;

            var cts = new CancellationTokenSource();

            Task.Run(() => Store.InitAsync(), cts.Token).Wait(cts.Token);
        }
コード例 #5
0
        public JobSchedulerTests()
        {
            _store       = Substitute.For <IBatchStore>();
            _dateService = Substitute.For <IDateService>();
            _scheduler   = new JobScheduler(_store, _dateService);

            _now = new DateTime(2018, 1, 2, 3, 4, 5);

            _dateService.GetNow().Returns(_now);
        }
コード例 #6
0
ファイル: JobScheduler.cs プロジェクト: jamesmh/Minion
 public JobScheduler(IBatchStore store, IDateService dateService)
 {
     _store       = store;
     _dateService = dateService;
 }
コード例 #7
0
 public BathcEngineTests()
 {
     _store = Substitute.For <IBatchStore>();
     _dependencyResolver = Substitute.For <IDependencyResolver>();
     _logger             = Substitute.For <ILogger>();
 }
コード例 #8
0
 public JobScheduler()
 {
     _store       = MinionConfiguration.Configuration.Store;
     _dateService = MinionConfiguration.Configuration.DateService;
 }