コード例 #1
0
 protected function createStorageInstance()
 {
     $storageClient = null;
     if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNONPROD) {
         $storageClient = new Queue(TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD, false, AbstractRetryPolicy::retryN(10, 250));
     } else {
         $storageClient = new Queue(TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_HOST_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV, true, AbstractRetryPolicy::retryN(10, 250));
     }
     if (TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY) {
         $storageClient->setProxy(TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS);
     }
     return $storageClient;
 }
コード例 #2
0
ファイル: WindowsAzure.php プロジェクト: necrogami/zf2
  /**
   * Peek at the messages from the specified queue without removing them.
   *
   * @param  string $queueId
   * @param  int $num How many messages
   * @param  array  $options
   * @return \Zend\Cloud\QueueService\Message[]
   */
  public function peekMessages($queueId, $num = 1, $options = null)
  {
      try {
          if ($queueId instanceof \Zend\Service\WindowsAzure\Storage\QueueInstance) {
              $queueId = $queueId->Name;
          }
          return $this->_makeMessages($this->_storageClient->peekMessages($queueId, $num));
      } catch (WindowsAzureException\ExceptionInterface $e) {
          throw new Exception\RuntimeException('Error on peeking messages: '.$e->getMessage(), $e->getCode(), $e);
      }
 }