producer = $producer; } protected function configure() { $this->addArgument( "queue", InputArgument::REQUIRED, 'A queue whose consumers are to reload.' ); $this->addArgument( "consumers-labels", InputArgument::OPTIONAL, 'Labels of consumers to restart separated by comma.' ); $this->setDescription('Restart specified consumers by lables on specified queue.'); } protected function executeCommand(InputInterface $input, OutputInterface $output): int { $consumersLabels = $input->getArgument("consumers-labels"); if ($consumersLabels) { $consumersLabels = explode(',', $consumersLabels); } else { $consumersLabels = [null]; } foreach ($consumersLabels as $consumerLabel) { $this->producer->publishDie($input->getArgument("queue"), $consumerLabel); } return 0; } }