/**
  * @test
  */
 public function get_method_name_should_return_class_with_method_name()
 {
     $consumer = new Consumer();
     $method = new ReflectionMethod($consumer, 'consume');
     $consumerAnnotation = new ConsumerAnnotation();
     $container = new ConsumerContainer(self::TEST_PREFIX, $consumer, $method, $consumerAnnotation);
     $result = $container->getMethodName();
     verify($result)->equals(Consumer::class . '::consume');
 }
 /**
  * @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;
 }