コード例 #1
0
        private void StartConsumers(Command command)
        {
            int consumerCount = 0;

            if (command.Arguments.Length > 0 && !int.TryParse(command.Arguments[0], out consumerCount))
            {
                Console.WriteLine("INVALID CONSUMER COUNT");
                return;
            }

            if (_consumerController == null)
            {
                _consumerController = new ConsumerController(_client);
            }

            if (consumerCount == 0)
            {
                _consumerController.StartSelfAdjustingConsumers();
            }
            else
            {
                _consumerController.StartConsumers(consumerCount);
            }

            if (consumerCount == 0)
            {
                Console.WriteLine("SELF-ADJUSTING CONSUMERS STARTED");
            }
            else
            {
                Console.WriteLine($"{consumerCount} CONSUMERS STARTED | {_consumerController.ConsumerCount} CONSUMERS RUNNING");
            }
        }