Пример #1
0
        public void Start(CancellationToken token)
        {
            foreach (var worker in _workers)
            {
                worker.Start(token);
            }

            new Thread(async() => await RemoveOldJobsProcess(token).ConfigureAwait(false)).Start();

            _logger?.Information($"Queue {Name} has started.");
        }
Пример #2
0
        /// <summary>
        ///     Run the scheduler.
        /// </summary>
        /// <exception cref="InvalidOperationException"></exception>
        public static void Start()
        {
            if (!_isInit)
                return;

            if (_repository is null)
                throw new InvalidOperationException("You must declare a repository.");

            if (_executor is null)
                throw new InvalidOperationException("You must declare a executor.");

            _cts = new CancellationTokenSource();

            foreach (var queue in _queues.Values)
            {
                queue.Start(_cts.Token);
            }

            _logger?.Information($"Scheduler has started with options:\r\n"
              + $"      Queues: {{ {string.Join(", ", _options.Queues.Select(x => x.Name))} }}");

            new Thread(() => ReadRepositoryProcess(_cts.Token)).Start();
        }
Пример #3
0
 public void Start(CancellationToken token)
 {
     new Thread(async() => await ExecuteProcess(token).ConfigureAwait(false)).Start();
     _logger?.Information($"Worker {_id} has started.");
 }