Skip to content

Commit a4618dc

Browse files
committed
[async-command] Remove command subsriber interface. remove services.yaml
1 parent fa86373 commit a4618dc

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

DependencyInjection/AsyncCommandExtension.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@
22

33
namespace Enqueue\AsyncCommand\DependencyInjection;
44

5+
use Enqueue\AsyncCommand\Commands;
56
use Enqueue\AsyncCommand\RunCommandProcessor;
6-
use Symfony\Component\Config\FileLocator;
77
use Symfony\Component\DependencyInjection\ContainerBuilder;
88
use Symfony\Component\DependencyInjection\Extension\Extension;
9-
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
109

1110
class AsyncCommandExtension extends Extension
1211
{
13-
/**
14-
* {@inheritdoc}
15-
*/
1612
public function load(array $configs, ContainerBuilder $container)
1713
{
18-
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
19-
$loader->load('services.yml');
20-
21-
$service = $container->register('enqueue.async_command.run_command_processor', RunCommandProcessor::class)
22-
->addArgument('%kernel.project_dir%')
23-
;
24-
2514
foreach ($configs['clients'] as $client) {
26-
$service->addTag('enqueue.command_subscriber', ['client' => $client]);
15+
$id = sprintf('enqueue.async_command.%s.run_command_processor', $client);
16+
$container->register($id, RunCommandProcessor::class)
17+
->addArgument('%kernel.project_dir%')
18+
->addTag('enqueue.processor', [
19+
'client' => $client,
20+
'command' => Commands::RUN_COMMAND,
21+
'queue' => Commands::RUN_COMMAND,
22+
'queue_prefixed' => false,
23+
'exclusive' => true,
24+
])
25+
;
2726
}
2827
}
2928
}

Resources/config/services.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

RunCommandProcessor.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace Enqueue\AsyncCommand;
44

5-
use Enqueue\Client\CommandSubscriberInterface;
65
use Enqueue\Consumption\Result;
76
use Interop\Queue\Context;
87
use Interop\Queue\Message;
98
use Interop\Queue\Processor;
109
use Symfony\Component\Process\PhpExecutableFinder;
1110
use Symfony\Component\Process\Process;
1211

13-
final class RunCommandProcessor implements Processor, CommandSubscriberInterface
12+
final class RunCommandProcessor implements Processor
1413
{
1514
/**
1615
* @var string
@@ -42,16 +41,6 @@ public function process(Message $message, Context $context): Result
4241
return Result::ack();
4342
}
4443

45-
public static function getSubscribedCommand(): array
46-
{
47-
return [
48-
'command' => Commands::RUN_COMMAND,
49-
'queue' => Commands::RUN_COMMAND,
50-
'prefix_queue' => false,
51-
'exclusive' => true,
52-
];
53-
}
54-
5544
/**
5645
* @return string
5746
*/

0 commit comments

Comments
 (0)