Microsoft_WindowsAzure
[ class tree: Microsoft_WindowsAzure ] [ index: Microsoft_WindowsAzure ] [ all elements ]

Source for file Queue.php

Documentation is available at Queue.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2009, RealDolmen
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions are met:
  8.  *     * Redistributions of source code must retain the above copyright
  9.  *       notice, this list of conditions and the following disclaimer.
  10.  *     * Redistributions in binary form must reproduce the above copyright
  11.  *       notice, this list of conditions and the following disclaimer in the
  12.  *       documentation and/or other materials provided with the distribution.
  13.  *     * Neither the name of RealDolmen nor the
  14.  *       names of its contributors may be used to endorse or promote products
  15.  *       derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY RealDolmen ''AS IS'' AND ANY
  18.  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20.  * DISCLAIMED. IN NO EVENT SHALL RealDolmen BE LIABLE FOR ANY
  21.  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22.  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23.  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  *
  28.  * @category   Microsoft
  29.  * @package    Microsoft_WindowsAzure
  30.  * @subpackage Storage
  31.  * @copyright  Copyright (c) 2009, RealDolmen (http://www.realdolmen.com)
  32.  * @license    http://todo     name_todo
  33.  * @version    $Id: Blob.php 24241 2009-07-22 09:43:13Z unknown $
  34.  */
  35.  
  36. /**
  37.  * @see Microsoft_WindowsAzure_SharedKeyCredentials
  38.  */
  39. require_once 'Microsoft/WindowsAzure/SharedKeyCredentials.php';
  40.  
  41. /**
  42.  * @see Microsoft_WindowsAzure_RetryPolicy
  43.  */
  44. require_once 'Microsoft/WindowsAzure/RetryPolicy.php';
  45.  
  46. /**
  47.  * @see Microsoft_Http_Transport
  48.  */
  49. require_once 'Microsoft/Http/Transport.php';
  50.  
  51. /**
  52.  * @see Microsoft_Http_Response
  53.  */
  54. require_once 'Microsoft/Http/Response.php';
  55.  
  56. /**
  57.  * @see Microsoft_WindowsAzure_Storage
  58.  */
  59. require_once 'Microsoft/WindowsAzure/Storage.php';
  60.  
  61. /**
  62.  * Microsoft_WindowsAzure_Storage_QueueInstance
  63.  */
  64. require_once 'Microsoft/WindowsAzure/Storage/QueueInstance.php';
  65.  
  66. /**
  67.  * Microsoft_WindowsAzure_Storage_QueueMessage
  68.  */
  69. require_once 'Microsoft/WindowsAzure/Storage/QueueMessage.php';
  70.  
  71. /**
  72.  * @see Microsoft_WindowsAzure_Exception
  73.  */
  74. require_once 'Microsoft/WindowsAzure/Exception.php';
  75.  
  76.  
  77. /**
  78.  * @category   Microsoft
  79.  * @package    Microsoft_WindowsAzure
  80.  * @subpackage Storage
  81.  * @copyright  Copyright (c) 2009, RealDolmen (http://www.realdolmen.com)
  82.  * @license    http://phpazure.codeplex.com/license
  83.  */
  84. {
  85.     /**
  86.      * Maximal message size (in bytes)
  87.      */
  88.     const MAX_MESSAGE_SIZE = 8388608;
  89.     
  90.     /**
  91.      * Maximal message ttl (in seconds)
  92.      */
  93.     const MAX_MESSAGE_TTL = 604800;
  94.     
  95.     /**
  96.      * Creates a new Microsoft_WindowsAzure_Storage_Queue instance
  97.      *
  98.      * @param string $host Storage host name
  99.      * @param string $accountName Account name for Windows Azure
  100.      * @param string $accountKey Account key for Windows Azure
  101.      * @param boolean $usePathStyleUri Use path-style URI's
  102.      * @param Microsoft_WindowsAzure_RetryPolicy $retryPolicy Retry policy to use when making requests
  103.      */
  104.     public function __construct($host Microsoft_WindowsAzure_Storage::URL_DEV_QUEUE$accountName Microsoft_WindowsAzure_SharedKeyCredentials::DEVSTORE_ACCOUNT$accountKey Microsoft_WindowsAzure_SharedKeyCredentials::DEVSTORE_KEY$usePathStyleUri falseMicrosoft_WindowsAzure_RetryPolicy $retryPolicy null)
  105.     {
  106.         parent::__construct($host$accountName$accountKey$usePathStyleUri$retryPolicy);
  107.         
  108.         // API version
  109.         $this->_apiVersion = '2009-04-14';
  110.     }
  111.     
  112.     /**
  113.      * Check if a queue exists
  114.      * 
  115.      * @param string $queueName Queue name
  116.      * @return boolean 
  117.      */
  118.     public function queueExists($queueName '')
  119.     {
  120.         if ($queueName === '')
  121.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  122.         if (!self::isValidQueueName($queueName))
  123.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  124.             
  125.         // List queues
  126.         $queues $this->listQueues($queueName1);
  127.         foreach ($queues as $queue)
  128.         {
  129.             if ($queue->Name == $queueName)
  130.                 return true;
  131.         }
  132.         
  133.         return false;
  134.     }
  135.     
  136.     /**
  137.      * Create queue
  138.      *
  139.      * @param string $queueName Queue name
  140.      * @param array  $metadata  Key/value pairs of meta data
  141.      * @return object Queue properties
  142.      * @throws Microsoft_WindowsAzure_Exception
  143.      */
  144.     public function createQueue($queueName ''$metadata array())
  145.     {
  146.         if ($queueName === '')
  147.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  148.         if (!self::isValidQueueName($queueName))
  149.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  150.             
  151.         // Create metadata headers
  152.         $headers array();
  153.         foreach ($metadata as $key => $value)
  154.         {
  155.             $headers["x-ms-meta-" strtolower($key)$value;
  156.         }
  157.         
  158.         // Perform request
  159.         $response $this->performRequest($queueName''Microsoft_Http_Transport::VERB_PUT$headers);            
  160.         if ($response->isSuccessful())
  161.         {
  162.             return new Microsoft_WindowsAzure_Storage_QueueInstance(
  163.                 $queueName,
  164.                 $metadata
  165.             );
  166.         }
  167.         else
  168.         {
  169.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  170.         }
  171.     }
  172.     
  173.     /**
  174.      * Get queue
  175.      * 
  176.      * @param string $queueName  Queue name
  177.      * @return Microsoft_WindowsAzure_Storage_QueueInstance 
  178.      * @throws Microsoft_WindowsAzure_Exception
  179.      */
  180.     public function getQueue($queueName '')
  181.     {
  182.         if ($queueName === '')
  183.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  184.         if (!self::isValidQueueName($queueName))
  185.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  186.             
  187.         // Perform request
  188.         $response $this->performRequest($queueName'?comp=metadata'Microsoft_Http_Transport::VERB_GET);    
  189.         if ($response->isSuccessful())
  190.         {
  191.             // Parse metadata
  192.             $metadata array();
  193.             foreach ($response->getHeaders(as $key => $value)
  194.             {
  195.                 if (substr(strtolower($key)010== "x-ms-meta-")
  196.                 {
  197.                     $metadata[str_replace("x-ms-meta-"''strtolower($key))$value;
  198.                 }
  199.             }
  200.  
  201.             // Return queue
  202.             $queue new Microsoft_WindowsAzure_Storage_QueueInstance(
  203.                 $queueName,
  204.                 $metadata
  205.             );
  206.             $queue->ApproximateMessageCount intval($response->getHeader('x-ms-approximate-message-count'));
  207.             return $queue;
  208.         }
  209.         else
  210.         {
  211.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  212.         }
  213.     }
  214.     
  215.     /**
  216.      * Get queue metadata
  217.      * 
  218.      * @param string $queueName  Queue name
  219.      * @return array Key/value pairs of meta data
  220.      * @throws Microsoft_WindowsAzure_Exception
  221.      */
  222.     public function getQueueMetadata($queueName '')
  223.     {
  224.         if ($queueName === '')
  225.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  226.         if (!self::isValidQueueName($queueName))
  227.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  228.             
  229.         return $this->getQueue($queueName)->Metadata;
  230.     }
  231.     
  232.     /**
  233.      * Set queue metadata
  234.      * 
  235.      * 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.
  236.      *
  237.      * @param string $queueName  Queue name
  238.      * @param array  $metadata       Key/value pairs of meta data
  239.      * @throws Microsoft_WindowsAzure_Exception
  240.      */
  241.     public function setQueueMetadata($queueName ''$metadata array())
  242.     {
  243.         if ($queueName === '')
  244.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  245.         if (!self::isValidQueueName($queueName))
  246.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  247.         if (count($metadata== 0)
  248.             return;
  249.             
  250.         // Create metadata headers
  251.         $headers array();
  252.         foreach ($metadata as $key => $value)
  253.         {
  254.             $headers["x-ms-meta-" strtolower($key)$value;
  255.         }
  256.         
  257.         // Perform request
  258.         $response $this->performRequest($queueName'?comp=metadata'Microsoft_Http_Transport::VERB_PUT$headers);
  259.  
  260.         if (!$response->isSuccessful())
  261.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  262.     }
  263.     
  264.     /**
  265.      * Delete queue
  266.      *
  267.      * @param string $queueName Queue name
  268.      * @throws Microsoft_WindowsAzure_Exception
  269.      */
  270.     public function deleteQueue($queueName '')
  271.     {
  272.         if ($queueName === '')
  273.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  274.         if (!self::isValidQueueName($queueName))
  275.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  276.             
  277.         // Perform request
  278.         $response $this->performRequest($queueName''Microsoft_Http_Transport::VERB_DELETE);
  279.         if (!$response->isSuccessful())
  280.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  281.     }
  282.     
  283.     /**
  284.      * List queues
  285.      *
  286.      * @param string $prefix     Optional. Filters the results to return only queues whose name begins with the specified prefix.
  287.      * @param int    $maxResults 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)
  288.      * @param string $marker     Optional string value that identifies the portion of the list to be returned with the next list operation.
  289.      * @param int    $currentResultCount Current result count (internal use)
  290.      * @return array 
  291.      * @throws Microsoft_WindowsAzure_Exception
  292.      */
  293.     public function listQueues($prefix null$maxResults null$marker null$currentResultCount 0)
  294.     {
  295.         // Build query string
  296.         $queryString '?comp=list';
  297.         if (!is_null($prefix))
  298.             $queryString .= '&prefix=' $prefix;
  299.         if (!is_null($maxResults))
  300.             $queryString .= '&maxresults=' $maxResults;
  301.         if (!is_null($marker))
  302.             $queryString .= '&marker=' $marker;
  303.             
  304.         // Perform request
  305.         $response $this->performRequest(''$queryStringMicrosoft_Http_Transport::VERB_GET);    
  306.         if ($response->isSuccessful())
  307.         {
  308.             $xmlQueues $this->parseResponse($response)->Queues->Queue;
  309.             $xmlMarker = (string)$this->parseResponse($response)->NextMarker;
  310.  
  311.             $queues array();
  312.             if (!is_null($xmlQueues))
  313.             {
  314.                 for ($i 0$i count($xmlQueues)$i++)
  315.                 {
  316.                     $queues[new Microsoft_WindowsAzure_Storage_QueueInstance(
  317.                         (string)$xmlQueues[$i]->QueueName
  318.                     );
  319.                 }
  320.             }
  321.             $currentResultCount $currentResultCount count($queues);
  322.             if (!is_null($maxResults&& $currentResultCount $maxResults)
  323.             {
  324.                 if (!is_null($xmlMarker&& $xmlMarker != '')
  325.                 {
  326.                     $queues array_merge($queues$this->listQueues($prefix$maxResults$xmlMarker$currentResultCount));
  327.                 }
  328.             }
  329.             if (!is_null($maxResults&& count($queues$maxResults)
  330.                 $queues array_slice($queues0$maxResults);
  331.                 
  332.             return $queues;
  333.         }
  334.         else 
  335.         {
  336.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  337.         }
  338.     }
  339.     
  340.     /**
  341.      * Put message into queue
  342.      *
  343.      * @param string $queueName  Queue name
  344.      * @param string $message    Message
  345.      * @param int    $ttl        Message Time-To-Live (in seconds). Defaults to 7 days if the parameter is omitted.
  346.      * @throws Microsoft_WindowsAzure_Exception
  347.      */
  348.     public function putMessage($queueName ''$message ''$ttl null)
  349.     {
  350.         if ($queueName === '')
  351.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  352.         if (!self::isValidQueueName($queueName))
  353.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  354.         if (strlen($messageself::MAX_MESSAGE_SIZE)
  355.             throw new Microsoft_WindowsAzure_Exception('Message is too big. Message content should be < 8KB.');
  356.         if ($message == '')
  357.             throw new Microsoft_WindowsAzure_Exception('Message is not specified.');
  358.         if (!is_null($ttl&& ($ttl <= || $ttl self::MAX_MESSAGE_SIZE))
  359.             throw new Microsoft_WindowsAzure_Exception('Message TTL is invalid. Maximal TTL is 7 days (' self::MAX_MESSAGE_SIZE ' seconds) and should be greater than zero.');
  360.             
  361.         // Build query string
  362.         $queryString '';
  363.         if (!is_null($ttl))
  364.             $queryString .= '?messagettl=' $ttl;
  365.             
  366.         // Build body
  367.         $rawData '';
  368.         $rawData .= '<QueueMessage>';
  369.         $rawData .= '    <MessageText>' base64_encode($message'</MessageText>';
  370.         $rawData .= '</QueueMessage>';
  371.             
  372.         // Perform request
  373.         $response $this->performRequest($queueName '/messages'$queryStringMicrosoft_Http_Transport::VERB_POSTarray()false$rawData);
  374.  
  375.         if (!$response->isSuccessful())
  376.         {
  377.             throw new Microsoft_WindowsAzure_Exception('Error putting message into queue.');
  378.         }
  379.     }
  380.     
  381.     /**
  382.      * Get queue messages
  383.      *
  384.      * @param string $queueName         Queue name
  385.      * @param string $numOfMessages     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.
  386.      * @param int    $visibilityTimeout 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.
  387.      * @param string $peek              Peek only?
  388.      * @return array 
  389.      * @throws Microsoft_WindowsAzure_Exception
  390.      */
  391.     public function getMessages($queueName ''$numOfMessages 1$visibilityTimeout null$peek false)
  392.     {
  393.         if ($queueName === '')
  394.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  395.         if (!self::isValidQueueName($queueName))
  396.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  397.         if ($numOfMessages || $numOfMessages 32 || intval($numOfMessages!= $numOfMessages)
  398.             throw new Microsoft_WindowsAzure_Exception('Invalid number of messages to retrieve.');
  399.         if (!is_null($visibilityTimeout&& ($visibilityTimeout <= || $visibilityTimeout 7200))
  400.             throw new Microsoft_WindowsAzure_Exception('Visibility timeout is invalid. Maximum value is 2 hours (7200 seconds) and should be greater than zero.');
  401.             
  402.         // Build query string
  403.         $query array();
  404.         if ($peek)
  405.             $query['peekonly=true';
  406.         if ($numOfMessages 1)
  407.             $query['numofmessages=' $numOfMessages;
  408.         if (!$peek && !is_null($visibilityTimeout))
  409.             $query['visibilitytimeout=' $visibilityTimeout;   
  410.         $queryString '?' implode('&'$query);
  411.             
  412.         // Perform request
  413.         $response $this->performRequest($queueName '/messages'$queryStringMicrosoft_Http_Transport::VERB_GET);    
  414.         if ($response->isSuccessful())
  415.         {
  416.             // Parse results
  417.             $result $this->parseResponse($response);
  418.             if (!$result)
  419.                 return array();
  420.  
  421.             $xmlMessages null;
  422.             if (count($result->QueueMessage1)
  423.             {
  424.                 $xmlMessages $result->QueueMessage;
  425.             }
  426.             else
  427.             {
  428.                 $xmlMessages array($result->QueueMessage);
  429.             }
  430.  
  431.             $messages array();
  432.             for ($i 0$i count($xmlMessages)$i++)
  433.             {
  434.                 $messages[new Microsoft_WindowsAzure_Storage_QueueMessage(
  435.                     (string)$xmlMessages[$i]->MessageId,
  436.                     (string)$xmlMessages[$i]->InsertionTime,
  437.                     (string)$xmlMessages[$i]->ExpirationTime,
  438.                     ($peek '' : (string)$xmlMessages[$i]->PopReceipt),
  439.                     ($peek '' : (string)$xmlMessages[$i]->TimeNextVisible),
  440.                     base64_decode((string)$xmlMessages[$i]->MessageText)
  441.                 );
  442.             }
  443.                 
  444.             return $messages;
  445.         }
  446.         else 
  447.         {
  448.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  449.         }
  450.     }
  451.     
  452.     /**
  453.      * Peek queue messages
  454.      *
  455.      * @param string $queueName         Queue name
  456.      * @param string $numOfMessages     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.
  457.      * @return array 
  458.      * @throws Microsoft_WindowsAzure_Exception
  459.      */
  460.     public function peekMessages($queueName ''$numOfMessages 1)
  461.     {
  462.         return $this->getMessages($queueName$numOfMessagesnulltrue);
  463.     }
  464.     
  465.     /**
  466.      * Clear queue messages
  467.      *
  468.      * @param string $queueName         Queue name
  469.      * @throws Microsoft_WindowsAzure_Exception
  470.      */
  471.     public function clearMessages($queueName '')
  472.     {
  473.         if ($queueName === '')
  474.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  475.         if (!self::isValidQueueName($queueName))
  476.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  477.  
  478.         // Perform request
  479.         $response $this->performRequest($queueName '/messages'''Microsoft_Http_Transport::VERB_DELETE);    
  480.         if (!$response->isSuccessful())
  481.         {
  482.             throw new Microsoft_WindowsAzure_Exception('Error clearing messages from queue.');
  483.         }
  484.     }
  485.     
  486.     /**
  487.      * Delete queue message
  488.      *
  489.      * @param string $queueName                             Queue name
  490.      * @param Microsoft_WindowsAzure_Storage_QueueMessage $message Message to delete from queue. A message retrieved using "peekMessages" can NOT be deleted!
  491.      * @throws Microsoft_WindowsAzure_Exception
  492.      */
  493.     public function deleteMessage($queueName ''Microsoft_WindowsAzure_Storage_QueueMessage $message)
  494.     {
  495.         if ($queueName === '')
  496.             throw new Microsoft_WindowsAzure_Exception('Queue name is not specified.');
  497.         if (!self::isValidQueueName($queueName))
  498.             throw new Microsoft_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
  499.         if ($message->PopReceipt == '')
  500.             throw new Microsoft_WindowsAzure_Exception('A message retrieved using "peekMessages" can NOT be deleted! Use "getMessages" instead.');
  501.  
  502.         // Perform request
  503.         $response $this->performRequest($queueName '/messages/' $message->MessageId'?popreceipt=' $message->PopReceiptMicrosoft_Http_Transport::VERB_DELETE);    
  504.         if (!$response->isSuccessful())
  505.         {
  506.             throw new Microsoft_WindowsAzure_Exception($this->getErrorMessage($response'Resource could not be accessed.'));
  507.         }
  508.     }
  509.     
  510.     /**
  511.      * Is valid queue name?
  512.      *
  513.      * @param string $queueName Queue name
  514.      * @return boolean 
  515.      */
  516.     public static function isValidQueueName($queueName '')
  517.     {
  518.         if (!ereg("^[a-z0-9][a-z0-9-]*$"$queueName))
  519.             return false;
  520.     
  521.         if (strpos($queueName'--'!== false)
  522.             return false;
  523.     
  524.         if (strtolower($queueName!= $queueName)
  525.             return false;
  526.     
  527.         if (strlen($queueName|| strlen($queueName63)
  528.             return false;
  529.             
  530.         if (substr($queueName-1== '-')
  531.             return false;
  532.     
  533.         return true;
  534.     }
  535.     
  536.     /**
  537.      * Get error message from Microsoft_Http_Response
  538.      * 
  539.      * @param Microsoft_Http_Response $response Repsonse
  540.      * @param string $alternativeError Alternative error message
  541.      * @return string 
  542.      */
  543.     protected function getErrorMessage(Microsoft_Http_Response $response$alternativeError 'Unknown error.')
  544.     {
  545.         $response $this->parseResponse($response);
  546.         if ($response && $response->Message)
  547.             return (string)$response->Message;
  548.         else
  549.             return $alternativeError;
  550.     }
  551. }

Documentation generated on Thu, 26 Nov 2009 08:05:10 +0100 by phpDocumentor 1.4.3