public function createFromConnection(Connection $connection, $exchangeName, $queueName)
    {
        $identity = new Identity();
        $channel  = $this->channelFactory->createFromConnection($connection, $identity);

        if (!$this->exchangeRegistry->hasExchange($exchangeName, $channel)) {
            $exchange = $this->exchangeFactory->createNamed($exchangeName, $channel);
        } else {
            $exchange = $this->exchangeRegistry->getExchange($exchangeName, $channel);
        }

        if (!$this->queueRegistry->hasQueue($queueName, $channel, $exchange)) {
            $queue = $this->queueFactory->createNamed($queueName, $channel, $exchange);
        } else {
            $queue = $this->queueRegistry->getQueue($queueName, $channel, $exchange);
        }

        $consumer = new Consumer($identity, $connection, $channel, $exchange, $queue);

        return $consumer;
    }
public function createFromConnection(Connection $connection, $exchangeName, $queueName)
    {
        $identity = new Identity();
        $channel  = $this->channelFactory->createFromConnection($connection, $identity);

        if (!$this->exchangeRegistry->hasExchange($exchangeName, $channel)) {
            $exchange = $this->exchangeFactory->createNamed($exchangeName, $channel);
        } else {
            $exchange = $this->exchangeRegistry->getExchange($exchangeName, $channel);
        }

        if (!$this->queueRegistry->hasQueue($queueName, $channel, $exchange)) {
            $queue = $this->queueFactory->createNamed($queueName, $channel, $exchange);
        } else {
            $queue = $this->queueRegistry->getQueue($queueName, $channel, $exchange);
        }

        $consumer = new Consumer($identity, $connection, $channel, $exchange, $queue);

        return $consumer;
    }
@param Connection $connection
@param string     $exchangeName
@param string     $queueName

@return Consumer