|
@@ -53,7 +53,11 @@ class ProducerService
|
|
|
$actionRepository = $this->getEntityManager()->getRepository('WorkflowBundle:Action');
|
|
|
$actions = $actionRepository->findAllByEventAndObjectClass($eventName, $entityClass);
|
|
|
foreach ($actions as $action) {
|
|
|
- $this->publishMessage($action, $entity);
|
|
|
+ $routing_key = "";
|
|
|
+ if(getenv("AMQP_KEY") !== false){
|
|
|
+ $routing_key = getenv("AMQP_KEY");
|
|
|
+ }
|
|
|
+ $this->publishMessage($action, $entity, $routing_key);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -82,7 +86,7 @@ class ProducerService
|
|
|
* @param Action $action
|
|
|
* @param Entity $entity
|
|
|
*/
|
|
|
- public function publishMessage(Action $action, $entity)
|
|
|
+ public function publishMessage(Action $action, $entity, $routing_key = "")
|
|
|
{
|
|
|
$entityClass = get_class($entity);
|
|
|
$actionName = $action->getName();
|
|
@@ -93,7 +97,7 @@ class ProducerService
|
|
|
'entityClass' => $entityClass,
|
|
|
'entityId' => $entityId,
|
|
|
);
|
|
|
- $this->producer->publish(serialize($msg));
|
|
|
+ $this->producer->publish(serialize($msg), $routing_key);
|
|
|
|
|
|
$msg = serialize($msg);
|
|
|
|