src/Driver/PeclAmqpDriver.php
public function consume($queueName, callable $callback, $timeout = 0, $autoAck = true)
    {
        $this->connection->setReadTimeout($timeout);
        $this->getChannel()->setPrefetchCount(1);
        $queue = $this->getQueue($queueName);
        $flags = $autoAck ? AMQP_AUTOACK : AMQP_NOPARAM;

        try {
            $queue->consume(function (\AMQPEnvelope $message) use ($callback, $queueName) {

                $burrowMessage = new Message(
                    $message->getBody(),
                    $message->getRoutingKey(),
                    $message->getHeaders(),
                    $message->getCorrelationId(),
                    $message->getReplyTo()
                );
                $burrowMessage->setDeliveryTag($message->getDeliveryTag());
                $burrowMessage->setQueue($queueName);

                return $callback($burrowMessage);
            }, $flags);
        } catch (\AMQPQueueException $e) {
            if ($e->getMessage() === 'Consumer timeout exceed') {
                throw TimeoutException::build($e, $timeout);
            }
            throw ConsumerException::build($e);
        }
    }
public function consume($queueName, callable $callback, $timeout = 0, $autoAck = true)
    {
        $this->connection->setReadTimeout($timeout);
        $this->getChannel()->setPrefetchCount(1);
        $queue = $this->getQueue($queueName);
        $flags = $autoAck ? AMQP_AUTOACK : AMQP_NOPARAM;

        try {
            $queue->consume(function (\AMQPEnvelope $message) use ($callback, $queueName) {

                $burrowMessage = new Message(
                    $message->getBody(),
                    $message->getRoutingKey(),
                    $message->getHeaders(),
                    $message->getCorrelationId(),
                    $message->getReplyTo()
                );
                $burrowMessage->setDeliveryTag($message->getDeliveryTag());
                $burrowMessage->setQueue($queueName);

                return $callback($burrowMessage);
            }, $flags);
        } catch (\AMQPQueueException $e) {
            if ($e->getMessage() === 'Consumer timeout exceed') {
                throw TimeoutException::build($e, $timeout);
            }
            throw ConsumerException::build($e);
        }
    }
Consume the queue

@param string   $queueName
@param callable $callback
@param int      $timeout
@param bool     $autoAck

@return void

@throws ConsumerException
@throws TimeoutException
@throws \AMQPConnectionException
@throws \AMQPChannelException
@throws \AMQPQueueException
@throws \InvalidArgumentException
@throws AssertionFailedException