当前位置: 首页>>代码示例>>PHP>>正文


PHP SqsClient::getQueueUrl方法代码示例

本文整理汇总了PHP中Aws\Sqs\SqsClient::getQueueUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP SqsClient::getQueueUrl方法的具体用法?PHP SqsClient::getQueueUrl怎么用?PHP SqsClient::getQueueUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aws\Sqs\SqsClient的用法示例。


在下文中一共展示了SqsClient::getQueueUrl方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: readQueueAttributes

 /**
  * @param string $name
  * @throws OperationException
  * @return array
  */
 protected function readQueueAttributes($name)
 {
     try {
         // grab url before in order to read attributes
         $queueUrl = $this->client->getQueueUrl(['QueueName' => $name]);
         $attributes = $this->client->getQueueAttributes(['QueueUrl' => $queueUrl->get('QueueUrl'), 'AttributeNames' => ['All']]);
         return $attributes->get('Attributes');
     } catch (\Exception $e) {
         throw new OperationException(sprintf('Cannot read attributes for queue "%s":%s', $name, $e->getMessage()), $e->getCode(), $e);
     }
 }
开发者ID:ronan-gloo,项目名称:qu,代码行数:16,代码来源:SqsQueueManager.php

示例2: __construct

 /**
  * AwsSqsQueueAdapter constructor.
  *
  * @param string    $queueName  The name of the SQS queue
  * @param SqsClient $sqsClient  An SQS client
  * @param array     $config     Array of config values
  */
 public function __construct($queueName, SqsClient $sqsClient, $config = array())
 {
     $this->queueName = $queueName;
     $this->sqsClient = $sqsClient;
     $this->sqsUrl = $this->sqsClient->getQueueUrl(array('QueueName' => $this->queueName))->get('QueueUrl');
     $this->config = $config;
 }
开发者ID:fguillot,项目名称:simple-queue,代码行数:14,代码来源:AwsSqsQueueAdapter.php

示例3: __construct

 /**
  * Constructor
  *
  * @param SqsClient        $sqsClient
  * @param SqsQueueOptions  $options
  * @param string           $name
  * @param JobPluginManager $jobPluginManager
  */
 public function __construct(SqsClient $sqsClient, SqsQueueOptions $options, $name, JobPluginManager $jobPluginManager)
 {
     $this->sqsClient = $sqsClient;
     $this->queueOptions = $options;
     parent::__construct($name, $jobPluginManager);
     // If an URL has explicitly been given in the options, let's use it, otherwise we dynamically fetch it
     if (!$this->queueOptions->getQueueUrl()) {
         $queue = $this->sqsClient->getQueueUrl(array('QueueName' => $name));
         $this->queueOptions->setQueueUrl($queue['QueueUrl']);
     }
 }
开发者ID:eoko,项目名称:SlmQueueSqs,代码行数:19,代码来源:SqsQueue.php

示例4: getQueueUrl

 /**
  * @param string $queueId
  * @return string
  */
 protected function getQueueUrl($queueId)
 {
     if (empty($this->queueUrl)) {
         if (empty($queueId)) {
             $queueId = $this->getQueueId();
         }
         $response = $this->queueClient->getQueueUrl(["QueueName" => $queueId]);
         $this->queueUrl = $response->get("QueueUrl");
     }
     return $this->queueUrl;
 }
开发者ID:silktide,项目名称:queueball-sqs,代码行数:15,代码来源:Queue.php

示例5: __construct

 /**
  * Constructs the wrapper using the name of the queue and the aws credentials
  *
  * @param $name
  * @param $aws_credentials
  */
 public function __construct($name, $aws_credentials)
 {
     try {
         // Setup the connection to the queue
         $this->name = $name;
         $this->aws_credentials = $aws_credentials;
         $this->sqs_client = new SqsClient($this->aws_credentials);
         // Get the queue URL
         $this->url = $this->sqs_client->getQueueUrl(array('QueueName' => $this->name))->get('QueueUrl');
     } catch (Exception $e) {
         echo 'Error getting the queue url ' . $e->getMessage();
     }
 }
开发者ID:Avantians,项目名称:php-sqs-tutorial,代码行数:19,代码来源:Queue.php

示例6: execute

 /**
  * Executes the current command
  *
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $queueName = $input->getOption('queue');
     try {
         $queueUrl = $this->sqsClient->getQueueUrl(['QueueName' => $queueName])['QueueUrl'];
     } catch (SqsException $exception) {
         $output->writeln(sprintf('<error>Impossible to retrieve URL for queue "%s". Reason: %s</error>', $queueName, $exception->getMessage()));
         return;
     }
     $uri = rtrim($input->getOption('server'), '/') . '/' . ltrim($input->getOption('path'), '/');
     while (true) {
         $messages = $this->sqsClient->receiveMessage(['QueueUrl' => $queueUrl, 'AttributeNames' => ['All'], 'MaxNumberOfMessages' => 1, 'WaitTimeSeconds' => 20]);
         if (!$messages->hasKey('Messages')) {
             continue;
         }
         $this->processMessage($messages['Messages'][0], $uri, $queueName, $queueUrl, $output);
     }
 }
开发者ID:zf-fr,项目名称:zfr-eb-worker,代码行数:25,代码来源:WorkerCommand.php

示例7: getQueueUrl

 public function getQueueUrl()
 {
     if (!$this->url) {
         $result = $this->client->getQueueUrl(["QueueName" => $this->name]);
         if ($result['QueueUrl']) {
             $this->url = $result['QueueUrl'];
         } else {
             throw new \RuntimeException("Cannot find queue url for queue named {$this->name}");
         }
     }
     return $this->url;
 }
开发者ID:oasmobile,项目名称:php-aws-wrappers,代码行数:12,代码来源:SqsQueue.php

示例8: queueExists

 /**
  * Return the Queue Url
  *
  * This method relies on in-memory cache and the Cache provider
  * to reduce the need to needlessly call the create method on an existing
  * Queue.
  *
  * @return boolean
  */
 public function queueExists()
 {
     if (isset($this->queueUrl)) {
         return true;
     }
     $key = $this->getNameWithPrefix() . '_url';
     if ($this->cache->contains($key)) {
         $this->queueUrl = $this->cache->fetch($key);
         return true;
     }
     $result = $this->sqs->getQueueUrl(['QueueName' => $this->getNameWithPrefix()]);
     if ($this->queueUrl = $result->get('QueueUrl')) {
         return true;
     }
     return false;
 }
开发者ID:xabbuh,项目名称:qpush-bundle,代码行数:25,代码来源:AwsProvider.php

示例9: purgeQueue

 /**
  * @inheritdoc
  *
  * @throws SqsException
  */
 public function purgeQueue($queueName, $priority = null)
 {
     if (null === $priority) {
         $priorities = $this->priorityHandler->getAll();
         foreach ($priorities as $priority) {
             $this->purgeQueue($queueName, $priority);
         }
         return $this;
     }
     if (empty($queueName)) {
         throw new InvalidArgumentException('Parameter queueName empty or not defined.');
     }
     $queueUrl = $this->sqsClient->getQueueUrl(['QueueName' => $this->getQueueNameWithPrioritySuffix($queueName, $priority)])->get('QueueUrl');
     $this->sqsClient->purgeQueue(['QueueUrl' => $queueUrl]);
     return $this;
 }
开发者ID:bobey,项目名称:queue-client,代码行数:21,代码来源:SQSAdapter.php

示例10: purgeQueue

 /**
  * @inheritdoc
  *
  * @throws \InvalidArgumentException
  * @throws QueueAccessException
  */
 public function purgeQueue($queueName, Priority $priority = null)
 {
     if (null === $priority) {
         $priorities = $this->priorityHandler->getAll();
         foreach ($priorities as $priority) {
             $this->purgeQueue($queueName, $priority);
         }
         return $this;
     }
     if (empty($queueName)) {
         throw new \InvalidArgumentException('Queue name empty or not defined.');
     }
     try {
         $queueUrl = $this->sqsClient->getQueueUrl(['QueueName' => $this->getQueueNameWithPrioritySuffix($queueName, $priority)])->get('QueueUrl');
         $this->sqsClient->purgeQueue(['QueueUrl' => $queueUrl]);
     } catch (SqsException $e) {
         throw new QueueAccessException('Cannot purge queue', 0, $e);
     }
     return $this;
 }
开发者ID:ReputationVIP,项目名称:queue-client,代码行数:26,代码来源:SQSAdapter.php

示例11: testErrorParsing

 /**
  * @expectedException \Aws\Sqs\Exception\SqsException
  */
 public function testErrorParsing()
 {
     $this->sqs->getQueueUrl(array('QueueName' => 'php-fake-queue'));
 }
开发者ID:njbhatt18,项目名称:Amazon_API,代码行数:7,代码来源:IntegrationTest.php

示例12: getQueueUrl

 /**
  * Returns queue url
  * @param  string $queueName The name of the queue
  * @return string            The queue url
  */
 public function getQueueUrl($queueName)
 {
     if (array_key_exists($queueName, $this->queueUrls)) {
         return $this->queueUrls[$queueName];
     }
     $result = $this->client->getQueueUrl(array('QueueName' => $queueName));
     if ($result && ($queueUrl = $result['QueueUrl'])) {
         return $this->queueUrls[$queueName] = $queueUrl;
     }
     throw new \InvalidArgumentException("Queue url for queue {$queueName} not found");
 }
开发者ID:spekkionu,项目名称:sqs-queue-driver,代码行数:16,代码来源:SqsDriver.php


注:本文中的Aws\Sqs\SqsClient::getQueueUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。