/**
  * @param ConsumerContainer $consumerContainer
  *
  * @throws ConsumerException
  */
 private function registerConsumerContainer(ConsumerContainer $consumerContainer)
 {
     $consumerName = $consumerContainer->getConsumerName();
     if (isset($this->consumerContainers[$consumerName])) {
         $currentConsumer = $this->consumerContainers[$consumerName];
         throw new ConsumerException(sprintf('Can not register consumer method [%s] because the consumer method [%s] already uses that name', $consumerContainer->getMethodName(), $currentConsumer->getMethodName()));
     }
     $this->channel->queue_declare($consumerName, false, true, false, false);
     foreach ($consumerContainer->getBindings() as $binding) {
         $this->channel->queue_bind($consumerName, $this->exchangeName, $binding);
     }
     $this->channel->basic_qos($consumerName, $consumerContainer->getPrefetchCount(), false);
     $this->channel->basic_consume($consumerName, '', false, false, false, false, function (AMQPMessage $message) use($consumerContainer) {
         $this->consume($consumerContainer, $message);
         $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
     });
     $this->consumerContainers[$consumerName] = $consumerContainer;
 }