Final Class Yiisoft\Queue\Command\RunCommand
| Inheritance | Yiisoft\Queue\Command\RunCommand » Symfony\Component\Console\Command\Command |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Queue\Command\RunCommand | |
| configure() | Yiisoft\Queue\Command\RunCommand |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| execute() | Yiisoft\Queue\Command\RunCommand |
Method Details
| public mixed __construct ( Yiisoft\Queue\Provider\QueueProviderInterface $queueProvider, array $channels ) | ||
| $queueProvider | Yiisoft\Queue\Provider\QueueProviderInterface | |
| $channels | array | |
public function __construct(
private readonly QueueProviderInterface $queueProvider,
private readonly array $channels,
) {
parent::__construct();
}
| public void configure ( ) |
public function configure(): void
{
$this->addArgument(
'channel',
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
'Queue channel name list to connect to.',
$this->channels,
)
->addOption(
'maximum',
'm',
InputOption::VALUE_REQUIRED,
'Maximum number of messages to process in each channel. Default is 0 (no limits).',
0,
)
->addUsage('[channel1 [channel2 [...]]] --maximum 100');
}
| protected integer execute ( \Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output ) | ||
| $input | \Symfony\Component\Console\Input\InputInterface | |
| $output | \Symfony\Component\Console\Output\OutputInterface | |
protected function execute(InputInterface $input, OutputInterface $output): int
{
/** @var string $channel */
foreach ($input->getArgument('channel') as $channel) {
$output->write("Processing channel $channel... ");
$count = $this->queueProvider
->get($channel)
->run((int)$input->getOption('maximum'));
$output->writeln("Messages processed: $count.");
}
return 0;
}
Signup or Login in order to comment.