*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Queue / Adapter / AdapterInterface.php
blob27167776244c185c26fb57dbe0f76f3c943ab861
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Queue
17 * @subpackage Adapter
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 $
23 /**
24 * Interface for common queue operations
26 * @category Zend
27 * @package Zend_Queue
28 * @subpackage Adapter
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
34 /**
35 * Constructor
37 * @param array|Zend_Config $options
38 * @param Zend_Queue $queue
39 * @return void
41 public function __construct($options, Zend_Queue $queue = null);
43 /**
44 * Retrieve queue instance
46 * @return Zend_Queue
48 public function getQueue();
50 /**
51 * Set queue instnace
53 * @param Zend_Queue $queue
54 * @return Zend_Queue_Adapter_AdapterInterface
56 public function setQueue(Zend_Queue $queue);
58 /**
59 * Does a queue already exist?
61 * Use isSupported('isExists') to determine if an adapter can test for
62 * queue existance.
64 * @param string $name Queue name
65 * @return boolean
67 public function isExists($name);
69 /**
70 * Create a new queue
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
76 * readers.
78 * @param string $name Queue name
79 * @param integer $timeout Default visibility timeout
80 * @return boolean
82 public function create($name, $timeout=null);
84 /**
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
90 * @return boolean
92 public function delete($name);
94 /**
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.
100 * @return array
102 public function getQueues();
105 * Return the approximate number of messages in the queue
107 * @param Zend_Queue|null $queue
108 * @return integer
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
139 * unsuccessful.
141 * @param Zend_Queue_Message $message
142 * @return boolean
144 public function deleteMessage(Zend_Queue_Message $message);
146 /********************************************************************
147 * Supporting functions
148 *********************************************************************/
151 * Returns the configuration options in this adapter.
153 * @return array
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.
163 * @return array
165 public function getCapabilities();
168 * Indicates if a function is supported or not.
170 * @param string $name Function name
171 * @return boolean
173 public function isSupported($name);