File indexing completed on 2025-01-19 05:21:24
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Queue 0017 * @subpackage Adapter 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * Interface for common queue operations 0025 * 0026 * @category Zend 0027 * @package Zend_Queue 0028 * @subpackage Adapter 0029 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0030 * @license http://framework.zend.com/license/new-bsd New BSD License 0031 */ 0032 interface Zend_Queue_Adapter_AdapterInterface 0033 { 0034 /** 0035 * Constructor 0036 * 0037 * @param array|Zend_Config $options 0038 * @param Zend_Queue $queue 0039 * @return void 0040 */ 0041 public function __construct($options, Zend_Queue $queue = null); 0042 0043 /** 0044 * Retrieve queue instance 0045 * 0046 * @return Zend_Queue 0047 */ 0048 public function getQueue(); 0049 0050 /** 0051 * Set queue instnace 0052 * 0053 * @param Zend_Queue $queue 0054 * @return Zend_Queue_Adapter_AdapterInterface 0055 */ 0056 public function setQueue(Zend_Queue $queue); 0057 0058 /** 0059 * Does a queue already exist? 0060 * 0061 * Use isSupported('isExists') to determine if an adapter can test for 0062 * queue existance. 0063 * 0064 * @param string $name Queue name 0065 * @return boolean 0066 */ 0067 public function isExists($name); 0068 0069 /** 0070 * Create a new queue 0071 * 0072 * Visibility timeout is how long a message is left in the queue 0073 * "invisible" to other readers. If the message is acknowleged (deleted) 0074 * before the timeout, then the message is deleted. However, if the 0075 * timeout expires then the message will be made available to other queue 0076 * readers. 0077 * 0078 * @param string $name Queue name 0079 * @param integer $timeout Default visibility timeout 0080 * @return boolean 0081 */ 0082 public function create($name, $timeout=null); 0083 0084 /** 0085 * Delete a queue and all of its messages 0086 * 0087 * Return false if the queue is not found, true if the queue exists. 0088 * 0089 * @param string $name Queue name 0090 * @return boolean 0091 */ 0092 public function delete($name); 0093 0094 /** 0095 * Get an array of all available queues 0096 * 0097 * Not all adapters support getQueues(); use isSupported('getQueues') 0098 * to determine if the adapter supports this feature. 0099 * 0100 * @return array 0101 */ 0102 public function getQueues(); 0103 0104 /** 0105 * Return the approximate number of messages in the queue 0106 * 0107 * @param Zend_Queue|null $queue 0108 * @return integer 0109 */ 0110 public function count(Zend_Queue $queue = null); 0111 0112 /******************************************************************** 0113 * Messsage management functions 0114 *********************************************************************/ 0115 0116 /** 0117 * Send a message to the queue 0118 * 0119 * @param mixed $message Message to send to the active queue 0120 * @param Zend_Queue|null $queue 0121 * @return Zend_Queue_Message 0122 */ 0123 public function send($message, Zend_Queue $queue = null); 0124 0125 /** 0126 * Get messages in the queue 0127 * 0128 * @param integer|null $maxMessages Maximum number of messages to return 0129 * @param integer|null $timeout Visibility timeout for these messages 0130 * @param Zend_Queue|null $queue 0131 * @return Zend_Queue_Message_Iterator 0132 */ 0133 public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null); 0134 0135 /** 0136 * Delete a message from the queue 0137 * 0138 * Return true if the message is deleted, false if the deletion is 0139 * unsuccessful. 0140 * 0141 * @param Zend_Queue_Message $message 0142 * @return boolean 0143 */ 0144 public function deleteMessage(Zend_Queue_Message $message); 0145 0146 /******************************************************************** 0147 * Supporting functions 0148 *********************************************************************/ 0149 0150 /** 0151 * Returns the configuration options in this adapter. 0152 * 0153 * @return array 0154 */ 0155 public function getOptions(); 0156 0157 /** 0158 * Return a list of queue capabilities functions 0159 * 0160 * $array['function name'] = true or false 0161 * true is supported, false is not supported. 0162 * 0163 * @return array 0164 */ 0165 public function getCapabilities(); 0166 0167 /** 0168 * Indicates if a function is supported or not. 0169 * 0170 * @param string $name Function name 0171 * @return boolean 0172 */ 0173 public function isSupported($name); 0174 }