Prooph\ServiceBus\Container\AbstractBusFactory::attachRouter PHP Method

attachRouter() private method

private attachRouter ( MessageBus $bus, array $routerConfig, Interop\Container\ContainerInterface $container )
$bus Prooph\ServiceBus\MessageBus
$routerConfig array
$container Interop\Container\ContainerInterface
    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);
    }