Service/WindowsAzure/Storage/Queue.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- name_todo
- Package
- Zend_Service_WindowsAzure
- Subpackage
- Storage
- Version
- $Id: Queue.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Service_WindowsAzure_Storage_Queue
- Parent(s)
- \Zend_Service_WindowsAzure_Storage
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants

URL_DEV_QUEUE
= "127.0.0.1:10001"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::URL_DEV_QUEUE

URL_DEV_TABLE
= "127.0.0.1:10002"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::URL_DEV_TABLE

URL_CLOUD_BLOB
= "blob.core.windows.net"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::URL_CLOUD_BLOB

URL_CLOUD_QUEUE
= "queue.core.windows.net"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::URL_CLOUD_QUEUE

URL_CLOUD_TABLE
= "table.core.windows.net"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE

RESOURCE_CONTAINER
= "c"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER

RESOURCE_BLOB
= "b"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB

RESOURCE_TABLE
= "t"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::RESOURCE_TABLE

RESOURCE_ENTITY
= "e"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::RESOURCE_ENTITY

RESOURCE_QUEUE
= "q"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::RESOURCE_QUEUE

PREFIX_PROPERTIES
= "x-ms-prop-"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::PREFIX_PROPERTIES

PREFIX_METADATA
= "x-ms-meta-"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::PREFIX_METADATA

PREFIX_STORAGE_HEADER
= "x-ms-"
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::PREFIX_STORAGE_HEADER
Properties


string $_accountKey = ''
Account key for Windows Azure
Inherited from: \Zend_Service_WindowsAzure_Storage::$$_accountKey''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_accountKey


string $_accountName = ''
Account name for Windows Azure
Inherited from: \Zend_Service_WindowsAzure_Storage::$$_accountName''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_accountName


string $_apiVersion = '2009-09-19'
'2009-09-19'
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_apiVersion


\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $_credentials = null
Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::$$_credentialsnull
Details


string $_host = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_host


\Zend_Http_Client $_httpClientChannel = null
Zend_Http_Client channel used for communication with REST services
Inherited from: \Zend_Service_WindowsAzure_Storage::$$_httpClientChannelnull
Details- Type
- \Zend_Http_Client
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_httpClientChannel


string $_proxyCredentials = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyCredentials


int $_proxyPort = 80
80
Details- Type
- int
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyPort


string $_proxyUrl = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_proxyUrl


\Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $_retryPolicy = null
Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::$$_retryPolicynull
Details


boolean $_usePathStyleUri = false
false
Details- Type
- boolean
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_usePathStyleUri


boolean $_useProxy = false
false
Details- Type
- boolean
- Inherited_from
- \Zend_Service_WindowsAzure_Storage::$$_useProxy
Methods


__construct(string $host = \Zend_Service_WindowsAzure_Storage::URL_DEV_QUEUE, string $accountName = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, string $accountKey = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, boolean $usePathStyleUri = false, \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) : void
Creates a new Zend_Service_WindowsAzure_Storage_Queue instance
Name | Type | Description |
---|---|---|
$host | string | Storage host name |
$accountName | string | Account name for Windows Azure |
$accountKey | string | Account key for Windows Azure |
$usePathStyleUri | boolean | Use path-style URI's |
$retryPolicy | \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract | Retry policy to use when making requests |


_generateMetadataHeaders(array $metadata = array()) : \HTTP
Generate metadata headers
Inherited from: \Zend_Service_WindowsAzure_Storage::_generateMetadataHeaders()Name | Type | Description |
---|---|---|
$metadata | array |
Type | Description |
---|---|
\HTTP | headers containing metadata |


_getErrorMessage(\Zend_Http_Response $response, string $alternativeError = 'Unknown error.') : string
Get error message from Zend_Http_Response
Name | Type | Description |
---|---|---|
$response | \Zend_Http_Response | Repsonse |
$alternativeError | string | Alternative error message |
Type | Description |
---|---|
string |


_parseMetadataElement( $element = null) : array
Parse metadata XML
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseMetadataElement()Name | Type | Description |
---|---|---|
$element |
Type | Description |
---|---|
array |


_parseMetadataHeaders(array $headers = array()) : array
Parse metadata headers
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseMetadataHeaders()Name | Type | Description |
---|---|---|
$headers | array | HTTP headers containing metadata |
Type | Description |
---|---|
array |


_parseResponse(\Zend_Http_Response $response = null) : object
Parse result from Zend_Http_Response
Inherited from: \Zend_Service_WindowsAzure_Storage::_parseResponse()Name | Type | Description |
---|---|---|
$response | \Zend_Http_Response | Response from HTTP call |
Type | Description |
---|---|
object |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


_performRequest(string $path = '/', string $queryString = '', string $httpVerb = \Zend_Http_Client::GET, array $headers = array(), boolean $forTableStorage = false, mixed $rawData = null, string $resourceType = \Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, string $requiredPermission = \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ) : \Zend_Http_Response
Perform request using Zend_Http_Client channel
Inherited from: \Zend_Service_WindowsAzure_Storage::_performRequest()Name | Type | Description |
---|---|---|
$path | string | Path |
$queryString | string | Query string |
$httpVerb | string | HTTP verb the request will use |
$headers | array | x-ms headers to add |
$forTableStorage | boolean | Is the request for table storage? |
$rawData | mixed | Optional RAW HTTP data to be sent over the wire |
$resourceType | string | Resource type |
$requiredPermission | string | Required permission |
Type | Description |
---|---|
\Zend_Http_Response |


clearMessages(string $queueName = '') : void
Clear queue messages
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


createQueryStringFromArray(array $queryString) : string
Builds a query string from an array of elements
Inherited from: \Zend_Service_WindowsAzure_Storage::createQueryStringFromArray()Name | Type | Description |
---|---|---|
$queryString | array | Array of elements |
Type | Description |
---|---|
string | Assembled query string |


createQueue(string $queueName = '', array $metadata = array()) : object
Create queue
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$metadata | array | Key/value pairs of meta data |
Type | Description |
---|---|
object | Queue properties |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


createQueueIfNotExists(string $queueName = '', array $metadata = array()) : void
Create queue if it does not exist
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$metadata | array | Key/value pairs of meta data |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


deleteMessage(string $queueName = '', \Zend_Service_WindowsAzure_Storage_QueueMessage $message) : void
Delete queue message
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$message | \Zend_Service_WindowsAzure_Storage_QueueMessage | Message to delete from queue. A message retrieved using "peekMessages" can NOT be deleted! |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


deleteQueue(string $queueName = '') : void
Delete queue
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


getAccountName() : string
Returns the Windows Azure account name
Inherited from: \Zend_Service_WindowsAzure_Storage::getAccountName()Type | Description |
---|---|
string |


getBaseUrl() : string
Get base URL for creating requests
Inherited from: \Zend_Service_WindowsAzure_Storage::getBaseUrl()Type | Description |
---|---|
string |


getCredentials() : \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
Get Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::getCredentials()Type | Description |
---|---|
\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract |


getHttpClientChannel() : \Zend_Http_Client_Adapter_Interface
Retrieve HTTP client channel
Inherited from: \Zend_Service_WindowsAzure_Storage::getHttpClientChannel()Type | Description |
---|---|
\Zend_Http_Client_Adapter_Interface |


getMessages(string $queueName = '', string $numOfMessages = 1, int $visibilityTimeout = null, string $peek = false) : array
Get queue messages
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$numOfMessages | string | Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation. |
$visibilityTimeout | int | Optional. An integer value that specifies the message's visibility timeout in seconds. The maximum value is 2 hours. The default message visibility timeout is 30 seconds. |
$peek | string | Peek only? |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


getQueue(string $queueName = '') : \Zend_Service_WindowsAzure_Storage_QueueInstance
Get queue
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_QueueInstance |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


getQueueMetadata(string $queueName = '') : array
Get queue metadata
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Type | Description |
---|---|
array | Key/value pairs of meta data |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


hasMessages(string $queueName = '') : boolean
Checks to see if a given queue has messages
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


isValidMetadataName(string $metadataName = '') : boolean
Is valid metadata name?
Inherited from: \Zend_Service_WindowsAzure_Storage::isValidMetadataName()Name | Type | Description |
---|---|---|
$metadataName | string | Metadata name |
Type | Description |
---|---|
boolean |


isValidQueueName(string $queueName = '') : boolean
Is valid queue name?
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Type | Description |
---|---|
boolean |


isoDate(int $timestamp = null) : string
Generate ISO 8601 compliant date string in UTC time zone
Inherited from: \Zend_Service_WindowsAzure_Storage::isoDate()Name | Type | Description |
---|---|---|
$timestamp | int |
Type | Description |
---|---|
string |


listQueues(string $prefix = null, int $maxResults = null, string $marker = null, string $include = null, int $currentResultCount = 0) : array
List queues
Name | Type | Description |
---|---|---|
$prefix | string | Optional. Filters the results to return only queues whose name begins with the specified prefix. |
$maxResults | int | Optional. Specifies the maximum number of queues to return per call to Azure storage. This does NOT affect list size returned by this function. (maximum: 5000) |
$marker | string | Optional string value that identifies the portion of the list to be returned with the next list operation. |
$include | string | Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. (allowed values: '', 'metadata') |
$currentResultCount | int | Current result count (internal use) |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


peekMessages(string $queueName = '', string $numOfMessages = 1) : array
Peek queue messages
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$numOfMessages | string | Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. By default, a single message is retrieved from the queue with this operation. |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


putMessage(string $queueName = '', string $message = '', int $ttl = null) : void
Put message into queue
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$message | string | Message |
$ttl | int | Message Time-To-Live (in seconds). Defaults to 7 days if the parameter is omitted. |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


queueExists(string $queueName = '') : boolean
Check if a queue exists
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
Type | Description |
---|---|
boolean |


setCredentials(\Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials) : void
Set Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
Inherited from: \Zend_Service_WindowsAzure_Storage::setCredentials()Name | Type | Description |
---|---|---|
$credentials | \Zend_Service_WindowsAzure_Credentials_CredentialsAbstract | Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance to use for request signing. |


setHttpClientChannel(\Zend_Http_Client_Adapter_Interface | string $adapterInstance = 'Zend_Http_Client_Adapter_Proxy') : void
Set the HTTP client channel to use
Inherited from: \Zend_Service_WindowsAzure_Storage::setHttpClientChannel()Name | Type | Description |
---|---|---|
$adapterInstance | \Zend_Http_Client_Adapter_Interface | string | Adapter instance or adapter class name. |


setProxy(boolean $useProxy = false, string $proxyUrl = '', int $proxyPort = 80, string $proxyCredentials = '') : void
Name | Type | Description |
---|---|---|
$useProxy | boolean | Use proxy? |
$proxyUrl | string | Proxy URL |
$proxyPort | int | Proxy port |
$proxyCredentials | string | Proxy credentials |


setQueueMetadata(string $queueName = '', array $metadata = array()) : void
Set queue metadata
Calling the Set Queue Metadata operation overwrites all existing metadata that is associated with the queue. It's not possible to modify an individual name/value pair.
Name | Type | Description |
---|---|---|
$queueName | string | Queue name |
$metadata | array | Key/value pairs of meta data |
Exception | Description |
---|---|
\Zend_Service_WindowsAzure_Exception |


setRetryPolicy(\Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) : void
Set retry policy to use when making requests
Inherited from: \Zend_Service_WindowsAzure_Storage::setRetryPolicy()Name | Type | Description |
---|---|---|
$retryPolicy | \Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract | Retry policy to use when making requests |