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


PHP SqsClient::createQueue方法代码示例

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


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

示例1: createQueue

 /**
  * {@inheritDoc}
  */
 public function createQueue($queueId, $options = [])
 {
     $timeout = empty($options["messageLockTimeout"]) || !is_numeric($options["messageLockTimeout"]) ? self::DEFAULT_MESSAGE_LOCK_TIMEOUT : (int) $options["messageLockTimeout"];
     $attributes = ["VisibilityTimeout" => $timeout];
     $this->queueClient->createQueue(["QueueName" => $queueId, "Attributes" => $attributes]);
     $this->setQueueId($queueId);
 }
开发者ID:silktide,项目名称:queueball-sqs,代码行数:10,代码来源:Queue.php

示例2: create

 /**
  * {@inheritDoc}
  */
 public function create($options)
 {
     if (!$options instanceof SqsQueueConfig) {
         throw new InvalidArgumentException('$options cannot be used to create a new queue');
     }
     // SQS is resilient when creating a new queue, only if attributes are similar
     try {
         $this->client->createQueue(['QueueName' => $this->prepareQueueName($options->getName()), 'Attributes' => $options->toAttributes()]);
     } catch (\Exception $e) {
         throw new RuntimeException('Cannot create the queue with name ' . $options->getName(), $e->getCode(), $e);
     }
     $options->setAccountId($this->config->getAccountId());
     return new SqsQueue($this->client, $options);
 }
开发者ID:ronan-gloo,项目名称:qu,代码行数:17,代码来源:SqsQueueManager.php

示例3: createQueue

 public function createQueue(array $attributes = [])
 {
     $args = ['QueueName' => $this->name];
     if ($attributes) {
         /** @noinspection PhpUnusedLocalVariableInspection */
         foreach ($attributes as $k => &$v) {
             if (!in_array($k, self::MUTABLE_ATTRIBUTES)) {
                 throw new \InvalidArgumentException("Unknown attribute {$k}");
             }
         }
         $args['Attributes'] = $attributes;
     }
     $result = $this->client->createQueue($args);
     $this->url = $result['QueueUrl'];
 }
开发者ID:oasmobile,项目名称:php-aws-wrappers,代码行数:15,代码来源:SqsQueue.php

示例4: __construct

 /**
  * Create new Amazon SQS driver.
  *
  * You have to create aws client instnace and provide it to this driver.
  * You can use service builder or factory method.
  *
  * <code>
  *  use Aws\Sqs\SqsClient;
  *
  *  $client = SqsClient::factory(array(
  *    'profile' => '<profile in your aws credentials file>',
  *    'region'  => '<region name>'
  *  ));
  * </code>
  *
  * or
  *
  * <code>
  * use Aws\Common\Aws;
  *
  * // Create a service builder using a configuration file
  * $aws = Aws::factory('/path/to/my_config.json');
  *
  * // Get the client from the builder by namespace
  * $client = $aws->get('Sqs');
  * </code>
  *
  * More examples see: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-sqs.html
  *
  *
  * @see examples/sqs folder
  *
  * @param SqsClient     $client
  * @param string        $queueName
  * @param array         $queueAttributes
  */
 public function __construct(SqsClient $client, $queueName, $queueAttributes = [])
 {
     $this->client = $client;
     $this->queueName = $queueName;
     $this->serializer = new MessageSerializer();
     $result = $client->createQueue(['QueueName' => $queueName, 'Attributes' => $queueAttributes]);
     $this->queueUrl = $result->get('QueueUrl');
 }
开发者ID:tomaj,项目名称:hermes,代码行数:44,代码来源:AmazonSqsDriver.php

示例5: create

 public function create($name, $region = 'us-east-1', $key = null, $secret = null)
 {
     $data = ['region' => $region, 'version' => '2012-11-05', 'retries' => 40];
     if ($key != null && $secret != null) {
         $data['credentials'] = ['key' => $key, 'secret' => $secret];
     }
     $sqsClient = new SqsClient($data);
     $sqsQueue = $sqsClient->createQueue(['QueueName' => $name]);
     return $sqsQueue;
 }
开发者ID:ErikZigo,项目名称:syrup,代码行数:10,代码来源:QueueFactory.php

示例6: createQueue

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

示例7: createQueue

 /**
  * Creates an SQS Queue and returns the Queue Url
  *
  * The create method for SQS Queues is idempotent - if the queue already
  * exists, this method will return the Queue Url of the existing Queue.
  *
  * @return string
  */
 public function createQueue()
 {
     $result = $this->sqs->createQueue(['QueueName' => $this->getNameWithPrefix(), 'Attributes' => ['VisibilityTimeout' => $this->options['message_timeout'], 'MessageRetentionPeriod' => $this->options['message_expiration'], 'ReceiveMessageWaitTimeSeconds' => $this->options['receive_wait_time']]]);
     $this->queueUrl = $result->get('QueueUrl');
     $key = $this->getNameWithPrefix() . '_url';
     $this->cache->save($key, $this->queueUrl);
     $this->log(200, "Created SQS Queue", ['QueueUrl' => $this->queueUrl]);
     if ($this->options['push_notifications']) {
         $policy = $this->createSqsPolicy();
         $this->sqs->setQueueAttributes(['QueueUrl' => $this->queueUrl, 'Attributes' => ['Policy' => $policy]]);
         $this->log(200, "Created Updated SQS Policy");
     }
 }
开发者ID:uecode,项目名称:qpush-bundle,代码行数:21,代码来源:AwsProvider.php

示例8: createQueue

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

示例9: testSubscribesToTopic

 /**
  * @depends testCreatesTopic
  */
 public function testSubscribesToTopic($topicArn)
 {
     // Create an SQS queue for the test
     self::log('Creating a SQS queue');
     $result = $this->sqs->createQueue(array('QueueName' => self::$queueName));
     self::$queueUrl = $result['QueueUrl'];
     $queueArn = $this->sqs->getQueueArn(self::$queueUrl);
     // Subscribe to the SNS topic using an SQS queue
     self::log('Subscribing to the topic using the queue');
     $result = $this->sns->subscribe(array('TopicArn' => self::$topicArn, 'Endpoint' => $queueArn, 'Protocol' => 'sqs'));
     // Ensure that the result has a SubscriptionArn
     self::log('Subscribe result: ' . var_export($result->toArray(), true));
     $this->assertArrayHasKey('SubscriptionArn', $result->toArray());
     self::$subscriptionArn = $result['SubscriptionArn'];
     return self::$subscriptionArn;
 }
开发者ID:njbhatt18,项目名称:Amazon_API,代码行数:19,代码来源:IntegrationTest.php

示例10: createQueue

 private function createQueue()
 {
     $result = $this->client->createQueue(array('QueueName' => $this->queueName));
     $this->queueUrl = $result->get('QueueUrl');
     $this->client->setQueueAttributes(array('QueueUrl' => $this->queueUrl, 'Attributes' => array('VisibilityTimeout' => $this->visibilityTimeout)));
 }
开发者ID:pekkis,项目名称:queue,代码行数:6,代码来源:AmazonSQSAdapter.php

示例11: addQueue

 public function addQueue($queueName)
 {
     $result = $this->service->createQueue(array('QueueName' => $queueName));
     $queueUrl = $result->get('QueueUrl');
     return $queueUrl;
 }
开发者ID:sebastien-fauvel,项目名称:Amazon-Mws-Repricing,代码行数:6,代码来源:AwsSqsService.php


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