Explorar o código

agregue routing key a los eventos lanzados desde la consola

Luciano Andrade %!s(int64=7) %!d(string=hai) anos
pai
achega
dc130dd1b6
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      Event/EventSubscriber.php

+ 6 - 1
Event/EventSubscriber.php

@@ -124,7 +124,12 @@ class EventSubscriber implements EventSubscriberInterface
         $logger = $this->container->get('logger');
 
         $object = $params['entity'];
-        $this->producerService->publishMessage($action, $object);
+        $routing_key = "";
+        if(getenv("AMQP_KEY") !== false){
+             $routing_key = getenv("AMQP_KEY");
+        }
+
+        $this->producerService->publishMessage($action, $object, $routing_key);
 
         $template = $action->getTemplate();
         $twig = new \Twig_Environment(new \Twig_Loader_Array(array()));