コード例 #1
0
ファイル: Db.php プロジェクト: trigoesrodrigo/icingaweb2
 /**
  * Create a new queue
  *
  * Visibility timeout is how long a message is left in the queue "invisible"
  * to other readers.  If the message is acknowleged (deleted) before the
  * timeout, then the message is deleted.  However, if the timeout expires
  * then the message will be made available to other queue readers.
  *
  * @param  string  $name    queue name
  * @param  integer $timeout default visibility timeout
  * @return boolean
  * @throws Zend_Queue_Exception - database error
  */
 public function create($name, $timeout = null)
 {
     if ($this->isExists($name)) {
         return false;
     }
     $queue = $this->_queueTable->createRow();
     $queue->queue_name = $name;
     $queue->timeout = $timeout === null ? self::CREATE_TIMEOUT_DEFAULT : (int) $timeout;
     try {
         if ($queue->save()) {
             return true;
         }
     } catch (Exception $e) {
         throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e);
     }
     return false;
 }
コード例 #2
0
ファイル: Db.php プロジェクト: jorgenils/zend-framework
 /**
  * Create a new queue
  *
  * @param  string  $name    queue name
  * @param  integer $timeout default visiblity timeout
  * @return boolean True
  */
 public function create($name, $timeout = null)
 {
     $queue = $this->_queue->createRow();
     $queue->queue_name = $name;
     $queue->timeout = $timeout === null ? 30 : (int) $timeout;
     try {
         if ($id = $queue->save()) {
             $this->setActiveQueue($id);
             return true;
         }
     } catch (Exception $e) {
         /**
          * @see Zend_Queue_Adapter_Exception
          */
         require_once 'Zend/Queue/Adapter/Exception.php';
         throw new Zend_Queue_Adapter_Exception($e->getMessage(), $e->getCode());
     }
     return false;
 }