File indexing completed on 2024-12-22 05:36:31
0001 <?php 0002 /** 0003 * LICENSE 0004 * 0005 * This source file is subject to the new BSD license that is bundled 0006 * with this package in the file LICENSE.txt. 0007 * It is also available through the world-wide-web at this URL: 0008 * http://framework.zend.com/license/new-bsd 0009 * If you did not receive a copy of the license and are unable to 0010 * obtain it through the world-wide-web, please send an email 0011 * to license@zend.com so we can send you a copy immediately. 0012 * 0013 * @category Zend 0014 * @package Zend_Cloud 0015 * @subpackage QueueService 0016 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0017 * @license http://framework.zend.com/license/new-bsd New BSD License 0018 */ 0019 0020 /** 0021 * Common interface for queue services in the cloud. This interface supports 0022 * most queue services and provides some flexibility for vendor-specific 0023 * features and requirements via an optional $options array in each method 0024 * signature. Classes implementing this interface should implement URI 0025 * construction for queues from the parameters given in each method and the 0026 * account data passed in to the constructor. Classes implementing this 0027 * interface are also responsible for security; access control isn't currently 0028 * supported in this interface, although we are considering access control 0029 * support in future versions of the interface. 0030 * 0031 * @category Zend 0032 * @package Zend_Cloud 0033 * @subpackage QueueService 0034 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0035 * @license http://framework.zend.com/license/new-bsd New BSD License 0036 */ 0037 interface Zend_Cloud_QueueService_Adapter 0038 { 0039 /** Ctor HTTP adapter option */ 0040 const HTTP_ADAPTER = 'http_adapter'; 0041 0042 /** Message visibility timeout option */ 0043 const VISIBILITY_TIMEOUT = 'visibility_timeout'; 0044 0045 /** Default visibility timeout */ 0046 const DEFAULT_TIMEOUT = 30; 0047 0048 /** 0049 * Create a queue. Returns the ID of the created queue (typically the URL). 0050 * It may take some time to create the queue. Check your vendor's 0051 * documentation for details. 0052 * 0053 * Name constraints: Maximum 80 characters 0054 * Only alphanumeric characters, hyphens (-), and underscores (_) 0055 * 0056 * @param string $name 0057 * @param array $options 0058 * @return string Queue ID (typically URL) 0059 */ 0060 public function createQueue($name, $options = null); 0061 0062 /** 0063 * Delete a queue. All messages in the queue will also be deleted. 0064 * 0065 * @param string $queueId 0066 * @param array $options 0067 * @return boolean true if successful, false otherwise 0068 */ 0069 public function deleteQueue($queueId, $options = null); 0070 0071 /** 0072 * List all queues. 0073 * 0074 * @param array $options 0075 * @return array Queue IDs 0076 */ 0077 public function listQueues($options = null); 0078 0079 /** 0080 * Get a key/value array of metadata for the given queue. 0081 * 0082 * @param string $queueId 0083 * @param array $options 0084 * @return array 0085 */ 0086 public function fetchQueueMetadata($queueId, $options = null); 0087 0088 /** 0089 * Store a key/value array of metadata for the specified queue. 0090 * WARNING: This operation overwrites any metadata that is located at 0091 * $destinationPath. Some adapters may not support this method. 0092 * 0093 * @param string $queueId 0094 * @param array $metadata 0095 * @param array $options 0096 * @return void 0097 */ 0098 public function storeQueueMetadata($queueId, $metadata, $options = null); 0099 0100 /** 0101 * Send a message to the specified queue. 0102 * 0103 * @param string $queueId 0104 * @param string $message 0105 * @param array $options 0106 * @return string Message ID 0107 */ 0108 public function sendMessage($queueId, $message, $options = null); 0109 0110 /** 0111 * Recieve at most $max messages from the specified queue and return the 0112 * message IDs for messages recieved. 0113 * 0114 * @param string $queueId 0115 * @param int $max 0116 * @param array $options 0117 * @return array[Zend_Cloud_QueueService_Message] Array of messages 0118 */ 0119 public function receiveMessages($queueId, $max = 1, $options = null); 0120 0121 /** 0122 * Peek at the messages from the specified queue without removing them. 0123 * 0124 * @param string $queueId 0125 * @param int $num How many messages 0126 * @param array $options 0127 * @return array[Zend_Cloud_QueueService_Message] 0128 */ 0129 public function peekMessages($queueId, $num = 1, $options = null); 0130 0131 /** 0132 * Delete the specified message from the specified queue. 0133 * 0134 * @param string $queueId 0135 * @param Zend_Cloud_QueueService_Message $message Message to delete 0136 * @param array $options 0137 * @return void 0138 * 0139 */ 0140 public function deleteMessage($queueId, $message, $options = null); 0141 0142 /** 0143 * Get the concrete adapter. 0144 */ 0145 public function getClient(); 0146 }