/** * Constructor * * @param array|\Zend\Config\Config $config An array having configuration data * @param \Zend\Queue\Queue The \Zend\Queue\Queue object that created this class * @return void */ public function __construct($options, Queue\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 Client\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') { throw new Queue\Exception("Unable to authenticate to '{$options['scheme']}://{$options['host']}:{$options['port']}'"); } }
/** * Constructor * * @param array|\Zend\Config\Config $options * @param \Zend\Queue\Queue|null $queue * @return void */ public function __construct($options, Queue\Queue $queue = null) { parent::__construct($options, $queue); if (!extension_loaded("jobqueue_client")) { throw new Queue\Exception('Platform Job Queue extension does not appear to be loaded'); } if (!isset($this->_options['daemonOptions'])) { throw new Queue\Exception('Job Queue host and password should be provided'); } $options = $this->_options['daemonOptions']; if (!array_key_exists('host', $options)) { throw new Queue\Exception('Platform Job Queue host should be provided'); } if (!array_key_exists('password', $options)) { throw new Queue\Exception('Platform Job Queue password should be provided'); } $this->_zendQueue = new \ZendAPI_Queue($options['host']); if (!$this->_zendQueue) { throw new Queue\Exception('Platform Job Queue connection failed'); } if (!$this->_zendQueue->login($options['password'])) { throw new Queue\Exception('Job Queue login failed'); } if ($this->_queue) { $this->_queue->setMessageClass('\\Zend\\Queue\\Message\\PlatformJob'); } }
/** * Constructor * * @param array|\Zend\Config\Config $options * @param \Zend\Queue\Queue|null $queue * @return void */ public function __construct($options, Queue\Queue $queue = null) { parent::__construct($options, $queue); if (!isset($this->_options['options'][Select\Select::FOR_UPDATE])) { // turn off auto update by default $this->_options['options'][Select\Select::FOR_UPDATE] = false; } if (!is_bool($this->_options['options'][Select\Select::FOR_UPDATE])) { throw new 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\AbstractAdapter) { $db = $this->_options['dbAdapter']; } else { $db = $this->_initDBAdapter(); } $this->_queueTable = new Queue(array('db' => $db)); $this->_messageTable = new Message(array('db' => $db)); }
/** * Constructor * * @param array|\Zend\Config\Config $options * @param null|\Zend\Queue\Queue $queue * @return void */ public function __construct($options, Queue\Queue $queue = null) { if (!extension_loaded('memcache')) { throw new 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) { throw new Queue\Exception('Could not connect to MemcacheQ'); } $this->_host = $options['host']; $this->_port = (int) $options['port']; }
/** * Constructor * * @param array|\Zend\Config\Config $options * @param null|\Zend\Queue\Queue $queue * @return void */ public function __construct($options, Queue\Queue $queue = null) { parent::__construct($options, $queue); }