コード例 #1
0
        public int GetScalingAmount(QueueInfo queueInfo, int consumersRunningCount)
        {
            var consumersByRatio = queueInfo.MessageCount / _messagesPerConsumerWorkerRatio;

            int idealConsumerCount;

            if (consumersByRatio < _minConcurrentConsumers)
            {
                idealConsumerCount = Convert.ToInt32(_minConcurrentConsumers);
            }
            else if (consumersByRatio > _maxConcurrentConsumers)
            {
                idealConsumerCount = Convert.ToInt32(_maxConcurrentConsumers);
            }
            else
            {
                idealConsumerCount = Convert.ToInt32(consumersByRatio);
            }

            var scalingAmount = idealConsumerCount - consumersRunningCount;

            return(scalingAmount);
        }
コード例 #2
0
        public int GetScalingAmount(QueueInfo queueInfo, int consumersRunningCount)
        {
            var consumersByRatio = queueInfo.MessageCount / _messagesPerConsumerWorkerRatio;

            int idealConsumerCount;

            if (consumersByRatio < _minConcurrentConsumers)
            {
                idealConsumerCount = Convert.ToInt32(_minConcurrentConsumers);
            }
            else if (consumersByRatio > _maxConcurrentConsumers)
            {
                idealConsumerCount = Convert.ToInt32(_maxConcurrentConsumers);
            }
            else
            {
                idealConsumerCount = Convert.ToInt32(consumersByRatio);
            }

            var scalingAmount = idealConsumerCount - consumersRunningCount;

            return scalingAmount;
        }