Esempio n. 1
0
        protected override async Task <IEnumerable <QueueDataV2> > FetchResources()
        {
            var queueNames = await _queueSource.GetResourceNamesAsync();

            var uniqResourcesNames = queueNames
                                     .Select(i => TrimEnd(i, ErrorQueueSuffix, StringComparison.OrdinalIgnoreCase))
                                     .Distinct();

            var result = new List <QueueDataV2>();

            foreach (var resourcesName in uniqResourcesNames)
            {
                var workingQueueName = resourcesName;
                var errorQueueName   = $"{resourcesName}{ErrorQueueSuffix}";

                var hasWorkingQueue = queueNames.Any(i => string.Equals(workingQueueName, i));
                var hasErrorQueue   = queueNames.Any(i => string.Equals(errorQueueName, i));

                var resource = new QueueDataV2(resourcesName);

                if (hasWorkingQueue)
                {
                    resource.SetWorkingQueue(workingQueueName);
                    resource.SetErrorQueue(errorQueueName);
                }

                if (!hasWorkingQueue && hasErrorQueue)
                {
                    resource.SetErrorQueue(errorQueueName);
                }

                result.Add(resource);
            }

            return(result);
        }
Esempio n. 2
0
 private Task <IList <string> > ReadActiveQueueNames()
 {
     return(_queueSource.GetResourceNamesAsync());
 }