From 279a100e7c23b0e957a85207cfb555878ac691c3 Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Wed, 9 Aug 2017 09:19:57 +0100 Subject: [PATCH] Fix compilation of command routes. All subscriptions were being added as event routes meaning that RouterProcessor::routeCommand() wouldn't do anything as commandRoutes were appearing empty. This fixes that by checking to see if command subscriptions exist and extracting them into the commandRoutes argument on RouterProcessor. --- .../Compiler/BuildClientRoutingPass.php | 11 +++++++++++ pkg/enqueue-bundle/Resources/config/client.yml | 1 + 2 files changed, 12 insertions(+) diff --git a/pkg/enqueue-bundle/DependencyInjection/Compiler/BuildClientRoutingPass.php b/pkg/enqueue-bundle/DependencyInjection/Compiler/BuildClientRoutingPass.php index cb924de42..27a904a4c 100644 --- a/pkg/enqueue-bundle/DependencyInjection/Compiler/BuildClientRoutingPass.php +++ b/pkg/enqueue-bundle/DependencyInjection/Compiler/BuildClientRoutingPass.php @@ -2,6 +2,7 @@ namespace Enqueue\Bundle\DependencyInjection\Compiler; +use Enqueue\Client\Config; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -35,5 +36,15 @@ public function process(ContainerBuilder $container) $router = $container->getDefinition($routerId); $router->replaceArgument(1, $configs); + + if (isset($configs[Config::COMMAND_TOPIC])) { + $commandRoutes = []; + + foreach ($configs[Config::COMMAND_TOPIC] as $command) { + $commandRoutes[$command[0]] = $command[1]; + } + + $router->replaceArgument(2, $commandRoutes); + } } } diff --git a/pkg/enqueue-bundle/Resources/config/client.yml b/pkg/enqueue-bundle/Resources/config/client.yml index cc2b30f73..f7bf69ae8 100644 --- a/pkg/enqueue-bundle/Resources/config/client.yml +++ b/pkg/enqueue-bundle/Resources/config/client.yml @@ -42,6 +42,7 @@ services: arguments: - '@enqueue.client.driver' - [] + - [] tags: - name: 'enqueue.client.processor'