Example #1
0
 /**
  * {@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);
 }