BlueCollar.Worker.DequeueRecord C# (CSharp) Méthode

DequeueRecord() private méthode

Dequeues a job to do work on.
private DequeueRecord ( ) : WorkingRecord
Résultat WorkingRecord
        internal WorkingRecord DequeueRecord()
        {
            WorkingRecord working = null;
            QueueNameFilters queues = null;

            lock (this.runLocker)
            {
                queues = new QueueNameFilters(this.queueFilters.Include, this.queueFilters.Exclude);
            }

            using (IRepository repository = this.repositoryFactory.Create())
            {
                using (IDbTransaction transaction = repository.BeginTransaction(IsolationLevel.RepeatableRead))
                {
                    QueueRecord queued = repository.GetQueued(this.applicationName, queues, DateTime.UtcNow, transaction);

                    if (queued != null)
                    {
                        working = CreateWorking(queued, this.id, queued.ScheduleId, DateTime.UtcNow);

                        repository.DeleteQueued(queued.Id.Value, transaction);
                        working = repository.CreateWorking(working, transaction);

                        this.logger.Info("Worker {0} ({1}) dequeued '{2}'.", this.name, this.id, queued.JobName);
                    }

                    transaction.Commit();
                }
            }

            return working;
        }