src/ExchangeLocator/ContainerLocator.php
public function getExchangeForMessage(Message $message)
    {
        if (!$message instanceof AMQPAwareMessage) {
            throw MissingExchangeException::unsupportedMessage($message);
        }

        $serviceId = $this->getExchangeServiceId($message);
        if (!$this->container->has($serviceId)) {
            throw MissingExchangeException::noService($message, $serviceId);
        }

        if (
            !isset($this->exchanges[$serviceId]) ||
            !$this->exchanges[$serviceId]->getChannel()->isConnected()
        ) {
            /** @var \Boekkooi\Bundle\AMQP\LazyExchange $exchange */
            $exchange = $this->container->get($serviceId);
            $this->exchanges[$serviceId] = $exchange->create(
                $this->initializeChannel($message)
            );
        }

        return $this->exchanges[$serviceId];
    }
public function getExchangeForMessage(Message $message)
    {
        if (!$message instanceof AMQPAwareMessage) {
            throw MissingExchangeException::unsupportedMessage($message);
        }

        $serviceId = $this->getExchangeServiceId($message);
        if (!$this->container->has($serviceId)) {
            throw MissingExchangeException::noService($message, $serviceId);
        }

        if (
            !isset($this->exchanges[$serviceId]) ||
            !$this->exchanges[$serviceId]->getChannel()->isConnected()
        ) {
            /** @var \Boekkooi\Bundle\AMQP\LazyExchange $exchange */
            $exchange = $this->container->get($serviceId);
            $this->exchanges[$serviceId] = $exchange->create(
                $this->initializeChannel($message)
            );
        }

        return $this->exchanges[$serviceId];
    }
{@inheritdoc}