library/Rediska/Zend/Queue/Adapter/Redis.php
public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
    {
        if ($maxMessages === null) {
            $maxMessages = 1;
        }
        if ($queue === null) {
            $queue = $this->_queue;
        }

        $queueName = $queue->getName();

        if (!$this->isExists($queueName)) {
            require_once 'Zend/Queue/Exception.php';
            throw new Zend_Queue_Exception('Queue does not exist:' . $queueName);
        }

        if (!isset($this->_queueObjects[$queueName])) {
            $this->_queueObjects[$queueName] = new Rediska_Key_List($this->_getKeyName("queue_$queueName"), array('rediska' => $this->_rediska));
        }

        $messages = array();
        for ($i = 0; $i < $maxMessages; $i++) {
            $message = $this->_queueObjects[$queueName]->pop();
            if (!is_null($message)) {
                $messages[] = array('body' => $message);
            }
        }

        $options = array(
            'queue'        => $queue,
            'data'         => $messages,
            'messageClass' => $queue->getMessageClass(),
        );

        $classname = $queue->getMessageSetClass();
        if (!class_exists($classname)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($classname);
        }
        return new $classname($options);
    }
public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
    {
        if ($maxMessages === null) {
            $maxMessages = 1;
        }
        if ($queue === null) {
            $queue = $this->_queue;
        }

        $queueName = $queue->getName();

        if (!$this->isExists($queueName)) {
            require_once 'Zend/Queue/Exception.php';
            throw new Zend_Queue_Exception('Queue does not exist:' . $queueName);
        }

        if (!isset($this->_queueObjects[$queueName])) {
            $this->_queueObjects[$queueName] = new Rediska_Key_List($this->_getKeyName("queue_$queueName"), array('rediska' => $this->_rediska));
        }

        $messages = array();
        for ($i = 0; $i < $maxMessages; $i++) {
            $message = $this->_queueObjects[$queueName]->pop();
            if (!is_null($message)) {
                $messages[] = array('body' => $message);
            }
        }

        $options = array(
            'queue'        => $queue,
            'data'         => $messages,
            'messageClass' => $queue->getMessageClass(),
        );

        $classname = $queue->getMessageSetClass();
        if (!class_exists($classname)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($classname);
        }
        return new $classname($options);
    }
Get messages in the queue

@param  integer    $maxMessages  Maximum number of messages to return
@param  integer    $timeout      Visibility timeout for these messages
@param  Zend_Queue $queue
@return Zend_Queue_Message_Iterator