/** * Executes the current command. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * * @return integer 0 if everything went fine, or an error code * * @throws \InvalidArgumentException When the number of messages to consume is less than 0 */ protected function execute(InputInterface $input, OutputInterface $output) { define('AMQP_DEBUG', (bool) $input->getOption('debug')); if (($amount = $input->getOption('messages')) < 0) { throw new \InvalidArgumentException("The -m option should be null or greater than 0"); } $rpcServer = $this->registry->getRpcServer($input->getArgument('name')); $rpcServer->start($amount); }