Base class for a message bus implementation
Author: Alexander Miertsch (kontakt@codeliner.ws)
Ejemplo n.º 1
0
 /**
  * @param MessageBus $bus
  * @param array $routerConfig
  */
 private function attachRouter(MessageBus $bus, array &$routerConfig)
 {
     $routerClass = isset($routerConfig['type']) ? (string) $routerConfig['type'] : $this->getDefaultRouterClass();
     $routes = isset($routerConfig['routes']) ? $routerConfig['routes'] : [];
     $router = new $routerClass($routes);
     $bus->utilize($router);
 }
Ejemplo n.º 2
0
 /**
  * @param MessageBus $bus
  * @param array $routerConfig
  * @param ContainerInterface $container
  */
 private function attachRouter(MessageBus $bus, array $routerConfig, ContainerInterface $container)
 {
     $routerClass = isset($routerConfig['type']) ? (string) $routerConfig['type'] : $this->getDefaultRouterClass();
     $routes = isset($routerConfig['routes']) ? $routerConfig['routes'] : [];
     $router = new $routerClass($routes);
     if (isset($routerConfig['async_switch'])) {
         $asyncMessageProducer = $container->get($routerConfig['async_switch']);
         $router = new AsyncSwitchMessageRouter($router, $asyncMessageProducer);
     }
     $bus->utilize($router);
 }