-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathConfigureRabbitMqCommand.php
More file actions
36 lines (30 loc) · 1 KB
/
ConfigureRabbitMqCommand.php
File metadata and controls
36 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace CodelyTv\Apps\Mooc\Backend\Command\DomainEvents\RabbitMq;
use CodelyTv\Shared\Infrastructure\Bus\Event\RabbitMq\RabbitMqConfigurer;
use Override;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Traversable;
#[AsCommand(
name: 'codely:domain-events:rabbitmq:configure',
description: 'Configure the RabbitMQ to allow publish & consume domain events',
)]
final class ConfigureRabbitMqCommand extends Command
{
public function __construct(
private readonly RabbitMqConfigurer $configurer,
private readonly string $exchangeName,
private readonly Traversable $subscribers
) {
parent::__construct();
}
#[Override]
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->configurer->configure($this->exchangeName, ...iterator_to_array($this->subscribers));
return 0;
}
}