public function handlePeclDelivery(\AMQPEnvelope $delivery, \AMQPQueue $queue = null)
 {
     $this->count++;
     if ($this->limit && $this->count >= $this->limit) {
         $this->setCancel(true);
     }
     return $this->handleDelivery(AMQPPeclIncomingMessageAdapter::convert($delivery));
 }
Example #2
0
 /**
  * @throws AMQPServerException|AMQPServerConnectionException|ObjectNotFoundException
  * @return AMQPIncomingMessage
  **/
 public function basicGet($queue, $autoAck = true)
 {
     try {
         $obj = $this->lookupQueue($queue);
         $message = $obj->get($autoAck === true ? AMQP_AUTOACK : self::AMQP_NONE);
     } catch (Exception $e) {
         $this->clearConnection();
         throw new AMQPServerException($e->getMessage(), $e->getCode(), $e);
     }
     if (!$message) {
         throw new ObjectNotFoundException("AMQP queue with name '{$queue}' is empty");
     }
     return AMQPPeclIncomingMessageAdapter::convert($message);
 }