Beispiel #1
0
        async Task FetchLength(QueueLengthValue queueLength, CancellationToken token)
        {
            try
            {
                var queueReference = queueLength.QueueReference;

                await queueReference.FetchAttributesAsync(token).ConfigureAwait(false);

                queueLength.Length = queueReference.ApproximateMessageCount.GetValueOrDefault();

                problematicQueuesNames.TryRemove(queueLength.QueueName, out _);
            }
            catch (OperationCanceledException)
            {
                // no-op
            }
            catch (Exception ex)
            {
                // simple "log once" approach to do not flood logs
                if (problematicQueuesNames.TryAdd(queueLength.QueueName, queueLength.QueueName))
                {
                    Logger.Error($"Obtaining Azure Storage Queue count failed for '{queueLength.QueueName}'", ex);
                }
            }
        }
Beispiel #2
0
        public void TrackEndpointInputQueue(EndpointToQueueMapping queueToTrack)
        {
            var queueName = BackwardsCompatibleQueueNameSanitizer.Sanitize(queueToTrack.InputQueue);

            var queueClient = CloudStorageAccount.Parse(connectionString).CreateCloudQueueClient();

            var emptyQueueLength = new QueueLengthValue
            {
                QueueName      = queueName,
                Length         = 0,
                QueueReference = queueClient.GetQueueReference(queueName)
            };

            queueLengths.AddOrUpdate(queueToTrack, _ => emptyQueueLength, (_, existingQueueLength) => existingQueueLength);
        }
Beispiel #3
0
        public void Process(EndpointInstanceId endpointInstanceId, EndpointMetadataReport metadataReport)
        {
            var endpointInputQueue = new EndpointInputQueue(endpointInstanceId.EndpointName, metadataReport.LocalAddress);
            var queueName          = QueueNameSanitizer.Sanitize(metadataReport.LocalAddress);

            var queueClient = CloudStorageAccount.Parse(connectionString).CreateCloudQueueClient();

            var emptyQueueLength = new QueueLengthValue
            {
                QueueName      = queueName,
                Length         = 0,
                QueueReference = queueClient.GetQueueReference(queueName)
            };

            queueLengths.AddOrUpdate(endpointInputQueue, _ => emptyQueueLength, (_, existingQueueLength) => existingQueueLength);
        }