Mmoreram\RSQueueBundle\Command\ConsumerCommand::execute PHP Method

execute() protected method

Each time new payload is consumed from queue, consume() method is called. When iterations get the limit, process literaly dies
protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface An InputInterface instance
$output Symfony\Component\Console\Output\OutputInterface An OutputInterface instance
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->define();
        $consumer = $this->getContainer()->get('rsqueue.consumer');
        $iterations = (int) $input->getOption('iterations');
        $timeout = (int) $input->getOption('timeout');
        $sleep = (int) $input->getOption('sleep');
        $iterationsDone = 0;
        $queuesAlias = array_keys($this->methods);
        if ($this->shuffleQueues()) {
            shuffle($queuesAlias);
        }
        while ($response = $consumer->consume($queuesAlias, $timeout)) {
            list($queueAlias, $payload) = $response;
            $method = $this->methods[$queueAlias];
            /**
             * All custom methods must have these parameters
             *
             * InputInterface  $input   An InputInterface instance
             * OutputInterface $output  An OutputInterface instance
             * Mixed           $payload Payload
             */
            $this->{$method}($input, $output, $payload);
            if ($iterations > 0 && ++$iterationsDone >= $iterations) {
                break;
            }
            sleep($sleep);
        }
    }