src/Queue/PdoQueue.php
function pop($queue = null)
    {
        $qName = $this->_normalizeQueueName($queue);

        try
        {
            // Find
            //
            $this->conn->beginTransaction();

            $sql = "SELECT * FROM `{$this->table}` WHERE `queue_name` = '$qName' and `is_pop` = 0;";
            $stm = $this->conn->prepare($sql);
            $stm->execute();
            $stm->setFetchMode(\PDO::FETCH_ASSOC);
            $queued = $stm->fetch();


            // Update
            //
            if ($queued ) {
                $sql = "UPDATE `{$this->table}` SET `is_pop` = 1 WHERE `task_id` = '{$queued['task_id']}';";
                $this->conn->exec($sql);
            }


            $this->conn->commit();

        } catch (\Exception $e) {
            throw new exReadError(sprintf('Error While Read From PDO Client: (%s).', $e->getCode()), 0, $e);
        }

        if (! $queued )
            // Nothing In Queue..
            return null;


        $payload = unserialize($queued['payload']);
        return $payload;
    }
function pop($queue = null)
    {
        $qName = $this->_normalizeQueueName($queue);

        try
        {
            // Find
            //
            $this->conn->beginTransaction();

            $sql = "SELECT * FROM `{$this->table}` WHERE `queue_name` = '$qName' and `is_pop` = 0;";
            $stm = $this->conn->prepare($sql);
            $stm->execute();
            $stm->setFetchMode(\PDO::FETCH_ASSOC);
            $queued = $stm->fetch();


            // Update
            //
            if ($queued ) {
                $sql = "UPDATE `{$this->table}` SET `is_pop` = 1 WHERE `task_id` = '{$queued['task_id']}';";
                $this->conn->exec($sql);
            }


            $this->conn->commit();

        } catch (\Exception $e) {
            throw new exReadError(sprintf('Error While Read From PDO Client: (%s).', $e->getCode()), 0, $e);
        }

        if (! $queued )
            // Nothing In Queue..
            return null;


        $payload = unserialize($queued['payload']);
        return $payload;
    }
function pop ( $ queue = null ) { $ qName = $ this -> _normalizeQueueName ( $ queue ) ; try { // Find // $ this -> conn -> beginTransaction ( ) ; $ sql = "SELECT * FROM `{$this->table}` WHERE `queue_name` = '$qName' and `is_pop` = 0;" ; $ stm = $ this -> conn -> prepare ( $ sql ) ; $ stm -> execute ( ) ; $ stm -> setFetchMode ( \ PDO :: FETCH_ASSOC ) ; $ queued = $ stm -> fetch ( ) ; // Update // if ( $ queued ) { $ sql = "UPDATE `{$this->table}` SET `is_pop` = 1 WHERE `task_id` = '{$queued['task_id']}';" ; $ this -> conn -> exec ( $ sql ) ; } $ this -> conn -> commit ( ) ; } catch ( \ Exception $ e ) { throw new exReadError ( sprintf ( 'Error While Read From PDO Client: (%s).' , $ e -> getCode ( ) ) , 0 , $ e ) ; } if ( ! $ queued ) // Nothing In Queue.. return null ; $ payload = unserialize ( $ queued [ 'payload' ] ) ; return $ payload ; }
Pop From Queue

note: when you pop a message from queue you have to
release it when worker done with it.


@param string $queue

@return iPayloadQueued|null
@throws exIOError
Pop From Queue