public function receive($subscriber_id = null, $limit = -1)
    {
        if ($subscriber_id !== null) {
            throw new NotSupportedException('Not implemented. System V queues does not support subscriptions.');
        }
        $flags = $this->blocking ? 0 : MSG_IPC_NOWAIT;
        $messages = [];
        $count = 0;
        while (($limit == -1 || $count < $limit) && (msg_receive($this->getQueue(), 0, $msgtype, self::MSG_MAXSIZE, $message, true, $flags, $errorcode))) {
            $message->subscriber_id = $subscriber_id;
            $message->status = Message::AVAILABLE;
            $messages[] = $message;
            $count++;
        }

        return $messages;
    }
public function receive($subscriber_id = null, $limit = -1)
    {
        if ($subscriber_id !== null) {
            throw new NotSupportedException('Not implemented. System V queues does not support subscriptions.');
        }
        $flags = $this->blocking ? 0 : MSG_IPC_NOWAIT;
        $messages = [];
        $count = 0;
        while (($limit == -1 || $count < $limit) && (msg_receive($this->getQueue(), 0, $msgtype, self::MSG_MAXSIZE, $message, true, $flags, $errorcode))) {
            $message->subscriber_id = $subscriber_id;
            $message->status = Message::AVAILABLE;
            $messages[] = $message;
            $count++;
        }

        return $messages;
    }
public function receive ( $ subscriber_id = null , $ limit = - 1 ) { if ( $ subscriber_id !== null ) { throw new NotSupportedException ( 'Not implemented. System V queues does not support subscriptions.' ) ; } $ flags = $ this -> blocking ? 0 : MSG_IPC_NOWAIT ; $ messages = [ ] ; $ count = 0 ; while ( ( $ limit == - 1 || $ count < $ limit ) && ( msg_receive ( $ this -> getQueue ( ) , 0 , $ msgtype , self :: MSG_MAXSIZE , $ message , true , $ flags , $ errorcode ) ) ) { $ message -> subscriber_id = $ subscriber_id ; $ message -> status = Message :: AVAILABLE ; $ messages [ ] = $ message ; $ count ++ ; } return $ messages ; }
Gets available messages from the queue and removes them from the queue.
@param  mixed                 $subscriber_id unused, must be null
@param  integer               $limit         number of available messages that will be fetched from the queue, defaults to -1 which means no limit
@return array                 of Message objects
@throws NotSupportedException
Gets available messages from the queue and removes them from the queue .