![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-message-queue/Console/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\MessageQueue\Console; use Magento\Framework\Console\Cli; use Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * Command for put poison pill for MessageQueue consumers. */ class RestartConsumerCommand extends Command { private const COMMAND_QUEUE_CONSUMERS_RESTART = 'queue:consumers:restart'; /** * @var PoisonPillPutInterface */ private $poisonPillPut; /** * @param PoisonPillPutInterface $poisonPillPut * @param string|null $name */ public function __construct(PoisonPillPutInterface $poisonPillPut, $name = null) { parent::__construct($name); $this->poisonPillPut = $poisonPillPut; } /** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $this->poisonPillPut->put(); return Cli::RETURN_SUCCESS; } /** * @inheritdoc */ protected function configure() { $this->setName(self::COMMAND_QUEUE_CONSUMERS_RESTART); $this->setDescription('Restart MessageQueue consumers'); $this->setHelp( <<<HELP Command put poison pill for MessageQueue consumers and force to restart them after next status check. HELP ); parent::configure(); } }