7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: AdapterInterface.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 * Interface for common queue operations
29 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
30 * @license http://framework.zend.com/license/new-bsd New BSD License
32 interface Zend_Queue_Adapter_AdapterInterface
37 * @param array|Zend_Config $options
38 * @param Zend_Queue $queue
41 public function __construct($options, Zend_Queue
$queue = null);
44 * Retrieve queue instance
48 public function getQueue();
53 * @param Zend_Queue $queue
54 * @return Zend_Queue_Adapter_AdapterInterface
56 public function setQueue(Zend_Queue
$queue);
59 * Does a queue already exist?
61 * Use isSupported('isExists') to determine if an adapter can test for
64 * @param string $name Queue name
67 public function isExists($name);
72 * Visibility timeout is how long a message is left in the queue
73 * "invisible" to other readers. If the message is acknowleged (deleted)
74 * before the timeout, then the message is deleted. However, if the
75 * timeout expires then the message will be made available to other queue
78 * @param string $name Queue name
79 * @param integer $timeout Default visibility timeout
82 public function create($name, $timeout=null);
85 * Delete a queue and all of its messages
87 * Return false if the queue is not found, true if the queue exists.
89 * @param string $name Queue name
92 public function delete($name);
95 * Get an array of all available queues
97 * Not all adapters support getQueues(); use isSupported('getQueues')
98 * to determine if the adapter supports this feature.
102 public function getQueues();
105 * Return the approximate number of messages in the queue
107 * @param Zend_Queue|null $queue
110 public function count(Zend_Queue
$queue = null);
112 /********************************************************************
113 * Messsage management functions
114 *********************************************************************/
117 * Send a message to the queue
119 * @param mixed $message Message to send to the active queue
120 * @param Zend_Queue|null $queue
121 * @return Zend_Queue_Message
123 public function send($message, Zend_Queue
$queue = null);
126 * Get messages in the queue
128 * @param integer|null $maxMessages Maximum number of messages to return
129 * @param integer|null $timeout Visibility timeout for these messages
130 * @param Zend_Queue|null $queue
131 * @return Zend_Queue_Message_Iterator
133 public function receive($maxMessages = null, $timeout = null, Zend_Queue
$queue = null);
136 * Delete a message from the queue
138 * Return true if the message is deleted, false if the deletion is
141 * @param Zend_Queue_Message $message
144 public function deleteMessage(Zend_Queue_Message
$message);
146 /********************************************************************
147 * Supporting functions
148 *********************************************************************/
151 * Returns the configuration options in this adapter.
155 public function getOptions();
158 * Return a list of queue capabilities functions
160 * $array['function name'] = true or false
161 * true is supported, false is not supported.
165 public function getCapabilities();
168 * Indicates if a function is supported or not.
170 * @param string $name Function name
173 public function isSupported($name);