5 * Contains \Drupal\Console\Command\Debug\QueueCommand.
8 namespace Drupal\Console\Command\Debug;
10 use Drupal\Console\Core\Command\Command;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Drupal\Core\Queue\QueueFactory;
14 use Drupal\Core\Queue\QueueWorkerManagerInterface;
19 * @package Drupal\Console\Command\Debug
21 class QueueCommand extends Command
26 protected $queueFactory;
29 * @var QueueWorkerManagerInterface
31 protected $queueWorker;
34 * DebugCommand constructor.
36 * @param QueueWorkerManagerInterface $queueWorker
38 public function __construct(QueueFactory $queueFactory, QueueWorkerManagerInterface $queueWorker)
40 $this->queueFactory = $queueFactory;
41 $this->queueWorker = $queueWorker;
42 parent::__construct();
48 protected function configure()
51 ->setName('debug:queue')
52 ->setDescription($this->trans('commands.debug.queue.description'))
59 protected function execute(InputInterface $input, OutputInterface $output)
62 $this->trans('commands.debug.queue.messages.queue'),
63 $this->trans('commands.debug.queue.messages.items'),
64 $this->trans('commands.debug.queue.messages.class')
67 $tableBody = $this->listQueues();
69 $this->getIo()->table($tableHeader, $tableBody);
77 private function listQueues()
80 foreach ($this->queueWorker->getDefinitions() as $name => $info) {
81 $queues[$name] = $this->formatQueue($name);
91 private function formatQueue($name)
93 $q = $this->queueFactory->get($name);