Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function batchDelete(array $jobs)
 {
     // SQS can only handle up to 10 jobs, so if we have more jobs, we handle them in slices
     if (count($jobs) > 10) {
         do {
             $splicedJobs = array_splice($jobs, 0, 10);
             $this->batchDelete($splicedJobs);
         } while (count($splicedJobs) >= 10);
         return;
     }
     // SQS throws an exception if no jobs are inserted, which can happen due to the slicing method
     if (empty($jobs)) {
         return;
     }
     $parameters = array('QueueUrl' => $this->queueOptions->getQueueUrl(), 'Entries' => array());
     /** @var $job JobInterface */
     foreach ($jobs as $key => $job) {
         $jobParameters = array('Id' => $key, 'ReceiptHandle' => $job->getMetadata('receiptHandle'));
         $parameters['Entries'][] = $jobParameters;
     }
     $this->sqsClient->deleteMessageBatch($parameters);
 }
 public function testSettersAndGetters()
 {
     $options = new SqsQueueOptions(array('queue_url' => 'https://sqs.bar'));
     $this->assertEquals('https://sqs.bar', $options->getQueueUrl());
 }