本文整理汇总了PHP中Zend_Queue_Adapter_AdapterAbstract类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Queue_Adapter_AdapterAbstract类的具体用法?PHP Zend_Queue_Adapter_AdapterAbstract怎么用?PHP Zend_Queue_Adapter_AdapterAbstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Queue_Adapter_AdapterAbstract类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param Zend_Queue|null $queue
*
* @return self
*
* @throws Zend_Queue_Exception
*/
public function __construct($options, Zend_Queue $queue = null)
{
Zend_Queue_Adapter_AdapterAbstract::__construct($options, $queue);
if (!isset($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
// turn off auto update by default
$this->_options['options'][Zend_Db_Select::FOR_UPDATE] = false;
}
if (!is_bool($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
throw new Zend_Queue_Exception('Options array item: Zend_Db_Select::FOR_UPDATE must be boolean');
}
if (!isset($this->_options['dbAdapter']) || !$this->_options['dbAdapter'] instanceof Zend_Db_Adapter_Abstract) {
throw new Zend_Queue_Exception('dbAdapter must be set');
}
if (!isset($this->_options['dbQueueTable']) || empty($this->_options['dbQueueTable'])) {
throw new Zend_Queue_Exception('dbQueueTable must be set');
}
if (!isset($this->_options['dbMessageTable']) || empty($this->_options['dbMessageTable'])) {
throw new Zend_Queue_Exception('dbMessageTable must be set');
}
$db = $this->_options['dbAdapter'];
$queueTable = $this->_options['dbQueueTable'];
$messageTable = $this->_options['dbMessageTable'];
$this->_queueTable = new Zend_Db_Table(array('db' => $db, 'name' => $queueTable, 'primary' => 'queue_id'));
$this->_messageTable = new Zend_Db_Table(array('db' => $db, 'name' => $messageTable, 'primary' => 'message_id'));
}
开发者ID:robbieaverill,项目名称:Aoe_Queue,代码行数:35,代码来源:Db.php
示例2: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param Zend_Queue|null $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
if (!extension_loaded("jobqueue_client")) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Platform Job Queue extension does not appear to be loaded');
}
if (!isset($this->_options['daemonOptions'])) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Job Queue host and password should be provided');
}
$options = $this->_options['daemonOptions'];
if (!array_key_exists('host', $options)) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Platform Job Queue host should be provided');
}
if (!array_key_exists('password', $options)) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Platform Job Queue password should be provided');
}
$this->_zendQueue = new ZendApi_Queue($options['host']);
if (!$this->_zendQueue) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Platform Job Queue connection failed');
}
if (!$this->_zendQueue->login($options['password'])) {
require_once PHP_LIBRARY_PATH . 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Job Queue login failed');
}
if ($this->_queue) {
$this->_queue->setMessageClass('Zend_Queue_Message_PlatformJob');
}
}
开发者ID:netixx,项目名称:Stock,代码行数:40,代码来源:PlatformJobQueue.php
示例3: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param null|Zend_Queue $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
if (!extension_loaded('mongo')) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Mongo extension does not appear to be loaded');
}
parent::__construct($options, $queue);
$options =& $this->_options['driverOptions'];
if (!array_key_exists('host', $this->_options)) {
$this->_options['host'] = self::DEFAULT_HOST;
}
if (!array_key_exists('port', $this->_options)) {
$this->_options['port'] = self::DEFAULT_PORT;
}
if (!array_key_exists('persistent', $this->_options)) {
$this->_options['persistent'] = self::DEFAULT_PERSISTENT;
}
if (!array_key_exists('dbname', $this->_options)) {
$this->_options['dbname'] = self::DEFAULT_DBNAME;
}
if (!array_key_exists('collection', $this->_options)) {
$this->_options['collection'] = self::DEFAULT_COLLECTION;
}
$options = $this->_options;
$this->_conn = new Mongo($this->_options['host'], $this->_options['port'], $this->_options['persistent']);
$this->_db = $this->_conn->selectDB($this->_options['dbname']);
$result = $this->_collection = $this->_db->selectCollection($this->_options['collection']);
if ($result === false) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Could not connect to Mongo');
}
$this->_host = $options['host'];
$this->_port = (int) $options['port'];
}
开发者ID:stunti,项目名称:Stunti_Cache_Backend_Mongo,代码行数:41,代码来源:Mongo.php
示例4: __construct
/**
* Constructor
*
* @param array|Zend_Config $config An array having configuration data
* @param Zend_Queue The Zend_Queue object that created this class
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options);
$options =& $this->_options['driverOptions'];
if (!array_key_exists('scheme', $options)) {
$options['scheme'] = self::DEFAULT_SCHEME;
}
if (!array_key_exists('host', $options)) {
$options['host'] = self::DEFAULT_HOST;
}
if (!array_key_exists('port', $options)) {
$options['port'] = self::DEFAULT_PORT;
}
if (array_key_exists('stompClient', $options)) {
$this->_client = $options['stompClient'];
} else {
$this->_client = new Zend_Queue_Stomp_Client($options['scheme'], $options['host'], $options['port']);
}
$connect = $this->_client->createFrame();
// Username and password are optional on some messaging servers
// such as Apache's ActiveMQ
$connect->setCommand('CONNECT');
if (isset($options['username'])) {
$connect->setHeader('login', $options['username']);
$connect->setHeader('passcode', $options['password']);
}
$response = $this->_client->send($connect)->receive();
if (false !== $response && $response->getCommand() != 'CONNECTED') {
//require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Unable to authenticate to '" . $options['scheme'] . '://' . $options['host'] . ':' . $options['port'] . "'");
}
}
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:39,代码来源:Activemq.php
示例5: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param null|Zend_Queue $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
if (!extension_loaded('memcache')) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Memcache extension does not appear to be loaded');
}
parent::__construct($options, $queue);
$options = &$this->_options['driverOptions'];
if (!array_key_exists('host', $options)) {
$options['host'] = self::DEFAULT_HOST;
}
if (!array_key_exists('port', $options)) {
$options['port'] = self::DEFAULT_PORT;
}
$this->_cache = new Memcache();
$result = $this->_cache->connect($options['host'], $options['port']);
if ($result === false) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Could not connect to MemcacheQ');
}
$this->_host = $options['host'];
$this->_port = (int)$options['port'];
}
开发者ID:nhp,项目名称:shopware-4,代码行数:37,代码来源:Memcacheq.php
示例6: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param Zend_Queue|null $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
if (!isset($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
// turn off auto update by default
$this->_options['options'][Zend_Db_Select::FOR_UPDATE] = false;
}
if (!is_bool($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Options array item: Zend_Db_Select::FOR_UPDATE must be boolean');
}
if (isset($this->_options['dbAdapter'])
&& $this->_options['dbAdapter'] instanceof Zend_Db_Adapter_Abstract) {
$db = $this->_options['dbAdapter'];
} else {
$db = $this->_initDbAdapter();
}
$this->_queueTable = new Zend_Queue_Adapter_Db_Queue(array(
'db' => $db,
));
$this->_messageTable = new Zend_Queue_Adapter_Db_Message(array(
'db' => $db,
));
}
开发者ID:nhp,项目名称:shopware-4,代码行数:37,代码来源:Db.php
示例7: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param null|Zend_Queue $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
if (!empty($this->_options['driverOptions'])) {
$this->_rediska = $options['driverOptions'];
}
$this->_rediska = Rediska_Options_RediskaInstance::getRediskaInstance($this->_rediska, 'Zend_Queue_Exception', 'driverOptions');
$this->_queues = new Rediska_Key_Set($this->_getKeyName('queues'), array('rediska' => $this->_rediska));
}
开发者ID:tanya61612,项目名称:Pastexen,代码行数:16,代码来源:Redis.php
示例8: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param null|Zend_Queue $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
$defaultInstance = Rediska::getDefaultInstance();
if (empty($this->_options['driverOptions']) && $defaultInstance) {
$this->_rediska = $defaultInstance;
} else {
$this->_rediska = new Rediska($this->_options['driverOptions']);
}
$this->_queues = new Rediska_Key_Set($this->_getKeyName('queues'));
$this->_queues->setRediska($this->_rediska);
}
开发者ID:jahanzaibbahadur,项目名称:twich,代码行数:19,代码来源:Redis.php
示例9: __construct
public function __construct($options, Zend_Queue $queue = null)
{
$this->_queueModel = isset($options['queue_model']) ? $options['queue_model'] : Mage::getModel('enterprise_queue/queue');
unset($options['queue_model']);
$this->_queueTaskModel = isset($options['task_model']) ? $options['task_model'] : Mage::getModel('enterprise_queue/queue_task');
unset($options['task_model']);
$this->_queueCollection = isset($options['queue_collection']) ? $options['queue_collection'] : Mage::getResourceModel('enterprise_queue/queue_collection');
unset($options['queue_collection']);
$this->_queueTaskCollection = isset($options['queue_task_collection']) ? $options['queue_task_collection'] : Mage::getResourceModel('enterprise_queue/queue_task_collection');
unset($options['queue_task_collection']);
$this->_logger = isset($options['logger']) ? $options['logger'] : Mage::getModel('core/logger');
unset($options['logger']);
parent::__construct($options, $queue);
}
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:14,代码来源:Db.php
示例10: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param Zend_Queue|null $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
if (!isset($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
// turn off auto update by default
$this->_options['options'][Zend_Db_Select::FOR_UPDATE] = false;
}
if (!is_bool($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Options array item: Zend_Db_Select::FOR_UPDATE must be boolean');
}
$options =& $this->_options['driverOptions'];
if (!array_key_exists('type', $options)) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Configuration array must have a key for 'type' for the database type to use");
}
if (!array_key_exists('host', $options)) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Configuration array must have a key for 'host' for the host to use");
}
if (!array_key_exists('username', $options)) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Configuration array must have a key for 'username' for the username to use");
}
if (!array_key_exists('password', $options)) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Configuration array must have a key for 'password' for the password to use");
}
if (!array_key_exists('dbname', $options)) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception("Configuration array must have a key for 'dbname' for the database to use");
}
try {
$db = Zend_Db::factory($options['type'], $options);
$this->_queueTable = new Zend_Queue_Adapter_Db_Queue(array('db' => $db));
$this->_messageTable = new Zend_Queue_Adapter_Db_Message(array('db' => $db));
} catch (Zend_Db_Exception $e) {
require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('Error connecting to database: ' . $e->getMessage(), $e->getCode());
}
}
开发者ID:ki8asui,项目名称:isography,代码行数:48,代码来源:Db.php
示例11: __construct
/**
* Constructor
*
* @param array|Zend_Config $options
* @param null|Zend_Queue $queue
* @return void
*/
public function __construct($options, Zend_Queue $queue = null)
{
parent::__construct($options, $queue);
}
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:11,代码来源:Null.php
注:本文中的Zend_Queue_Adapter_AdapterAbstract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论