Пример #1
0
 public void StartBatchJob(Action <int> handler, BatchJobOptions options)
 {
     lock (batchJobLock)
     {
         if (batchJob == null || !batchJob.IsRunning)
         {
             batchJob = new BatchJob(options, logger);
             batchJob.Start(handler);
         }
         else
         {
             throw new InvalidOperationException("Batch job already started.");
         }
     }
 }
Пример #2
0
        public BatchJob(BatchJobOptions batchJobOptions, ILogger logger)
        {
            if (batchJobOptions == null)
            {
                throw new ArgumentNullException("BatchJobOptions cannot be null.");
            }

            batchJobOptions.Validate();

            MaxItems    = batchJobOptions.MaxItems;
            BatchSize   = batchJobOptions.BatchSize;
            DelayInSecs = batchJobOptions.DelayInSecs;
            IsRunning   = false;

            this.logger = logger;
        }