Example #1
0
        public IList <QueueWithTopEnqueuedJobsDto> Queues()
        {
            var s = _queueProviders
                    .Select(qProvider => qProvider.GetJobQueueMonitoringApi(ConnectionString))
                    .SelectMany(x => x.GetQueues())
                    .ToList();


            const int MaxFirstJobs = 5;

            var result = new List <QueueWithTopEnqueuedJobsDto>();

            foreach (var queue in s)
            {
                var monitoring = _queueProviders.GetProvider(queue).GetJobQueueMonitoringApi(ConnectionString);


                var qw = new QueueWithTopEnqueuedJobsDto()
                {
                    Fetched   = 0,
                    FirstJobs = EnqueuedJobs(queue, 0, MaxFirstJobs),
                    Length    = monitoring.GetEnqueuedAndFetchedCount(queue).EnqueuedCount.Value,
                    Name      = queue
                };


                result.Add(qw);
            }

            return(result);
            //return new List<QueueWithTopEnqueuedJobsDto>();
        }
Example #2
0
        public QueueModel(QueueWithTopEnqueuedJobsDto model)
        {
            Name = model.Name;

            JobCount = model.Length;
            NextJobs = model.FirstJobs.Select(j => new JobModel(j.Key, j.Value));
        }