web/lib/Zend/Cloud/QueueService/Adapter.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    11  * to license@zend.com so we can send you a copy immediately.
    11  * to license@zend.com so we can send you a copy immediately.
    12  *
    12  *
    13  * @category   Zend
    13  * @category   Zend
    14  * @package    Zend_Cloud
    14  * @package    Zend_Cloud
    15  * @subpackage QueueService
    15  * @subpackage QueueService
    16  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    16  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    17  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  */
    18  */
    19 
    19 
    20 /**
    20 /**
    21  * Common interface for queue services in the cloud. This interface supports
    21  * Common interface for queue services in the cloud. This interface supports
    29  * support in future versions of the interface.
    29  * support in future versions of the interface.
    30  *
    30  *
    31  * @category   Zend
    31  * @category   Zend
    32  * @package    Zend_Cloud
    32  * @package    Zend_Cloud
    33  * @subpackage QueueService
    33  * @subpackage QueueService
    34  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    34  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    36  */
    36  */
    37 interface Zend_Cloud_QueueService_Adapter
    37 interface Zend_Cloud_QueueService_Adapter
    38 {
    38 {
    39     /** Ctor HTTP adapter option */
    39     /** Ctor HTTP adapter option */
    47 
    47 
    48     /**
    48     /**
    49      * Create a queue. Returns the ID of the created queue (typically the URL).
    49      * Create a queue. Returns the ID of the created queue (typically the URL).
    50      * It may take some time to create the queue. Check your vendor's
    50      * It may take some time to create the queue. Check your vendor's
    51      * documentation for details.
    51      * documentation for details.
    52      * 
    52      *
    53      * Name constraints: Maximum 80 characters
    53      * Name constraints: Maximum 80 characters
    54      *                      Only alphanumeric characters, hyphens (-), and underscores (_)
    54      *                      Only alphanumeric characters, hyphens (-), and underscores (_)
    55      *
    55      *
    56      * @param  string $name
    56      * @param  string $name
    57      * @param  array  $options
    57      * @param  array  $options
    65      * @param  string $queueId
    65      * @param  string $queueId
    66      * @param  array  $options
    66      * @param  array  $options
    67      * @return boolean true if successful, false otherwise
    67      * @return boolean true if successful, false otherwise
    68      */
    68      */
    69     public function deleteQueue($queueId, $options = null);
    69     public function deleteQueue($queueId, $options = null);
    70     
    70 
    71     /**
    71     /**
    72      * List all queues.
    72      * List all queues.
    73      *
    73      *
    74      * @param  array $options
    74      * @param  array $options
    75      * @return array Queue IDs
    75      * @return array Queue IDs
    76      */
    76      */
    77     public function listQueues($options = null);
    77     public function listQueues($options = null);
    78     
    78 
    79     /**
    79     /**
    80      * Get a key/value array of metadata for the given queue.
    80      * Get a key/value array of metadata for the given queue.
    81      *
    81      *
    82      * @param  string $queueId
    82      * @param  string $queueId
    83      * @param  array  $options
    83      * @param  array  $options
    84      * @return array
    84      * @return array
    85      */
    85      */
    86     public function fetchQueueMetadata($queueId, $options = null);
    86     public function fetchQueueMetadata($queueId, $options = null);
    87     
    87 
    88     /**
    88     /**
    89      * Store a key/value array of metadata for the specified queue.
    89      * Store a key/value array of metadata for the specified queue.
    90      * WARNING: This operation overwrites any metadata that is located at 
    90      * WARNING: This operation overwrites any metadata that is located at
    91      * $destinationPath. Some adapters may not support this method.
    91      * $destinationPath. Some adapters may not support this method.
    92      * 
    92      *
    93      * @param  string $queueId
    93      * @param  string $queueId
    94      * @param  array  $metadata
    94      * @param  array  $metadata
    95      * @param  array  $options
    95      * @param  array  $options
    96      * @return void
    96      * @return void
    97      */
    97      */
    98     public function storeQueueMetadata($queueId, $metadata,  $options = null);
    98     public function storeQueueMetadata($queueId, $metadata,  $options = null);
    99     
    99 
   100     /**
   100     /**
   101      * Send a message to the specified queue.
   101      * Send a message to the specified queue.
   102      * 
   102      *
   103      * @param  string $queueId
   103      * @param  string $queueId
   104      * @param  string $message
   104      * @param  string $message
   105      * @param  array  $options
   105      * @param  array  $options
   106      * @return string Message ID
   106      * @return string Message ID
   107      */
   107      */
   108     public function sendMessage($queueId, $message,  $options = null);
   108     public function sendMessage($queueId, $message,  $options = null);
   109     
   109 
   110     /**
   110     /**
   111      * Recieve at most $max messages from the specified queue and return the
   111      * Recieve at most $max messages from the specified queue and return the
   112      * message IDs for messages recieved.
   112      * message IDs for messages recieved.
   113      * 
   113      *
   114      * @param  string $queueId
   114      * @param  string $queueId
   115      * @param  int    $max
   115      * @param  int    $max
   116      * @param  array  $options
   116      * @param  array  $options
   117      * @return array[Zend_Cloud_QueueService_Message]  Array of messages
   117      * @return array[Zend_Cloud_QueueService_Message]  Array of messages
   118      */
   118      */
   119     public function receiveMessages($queueId, $max = 1, $options = null);
   119     public function receiveMessages($queueId, $max = 1, $options = null);
   120         
   120 
   121     /**
   121     /**
   122      * Peek at the messages from the specified queue without removing them.
   122      * Peek at the messages from the specified queue without removing them.
   123      *
   123      *
   124      * @param  string $queueId
   124      * @param  string $queueId
   125      * @param  int $num How many messages
   125      * @param  int $num How many messages
   126      * @param  array  $options
   126      * @param  array  $options
   127      * @return array[Zend_Cloud_QueueService_Message]
   127      * @return array[Zend_Cloud_QueueService_Message]
   128      */
   128      */
   129     public function peekMessages($queueId, $num = 1, $options = null);
   129     public function peekMessages($queueId, $num = 1, $options = null);
   130     
   130 
   131     /**
   131     /**
   132      * Delete the specified message from the specified queue.
   132      * Delete the specified message from the specified queue.
   133      * 
   133      *
   134      * @param  string $queueId
   134      * @param  string $queueId
   135      * @param  Zend_Cloud_QueueService_Message $message Message to delete 
   135      * @param  Zend_Cloud_QueueService_Message $message Message to delete
   136      * @param  array  $options
   136      * @param  array  $options
   137      * @return void
   137      * @return void
   138      * 
   138      *
   139      */
   139      */
   140     public function deleteMessage($queueId, $message,  $options = null);
   140     public function deleteMessage($queueId, $message,  $options = null);
   141     
   141 
   142     /**
   142     /**
   143      * Get the concrete adapter.
   143      * Get the concrete adapter.
   144      */
   144      */
   145     public function getClient();
   145     public function getClient();
   146 }
   146 }