Exemple #1
0
 /**
  * @param CommandInterface $command
  * @param string $tube
  * @param int $priority
  * @param int $delay
  * @param int $timeToRun
  * @throws Exception
  */
 public function queue(CommandInterface $command, $tube = Beanie::DEFAULT_TUBE, $priority = Beanie::DEFAULT_PRIORITY, $delay = Beanie::DEFAULT_DELAY, $timeToRun = Beanie::DEFAULT_TIME_TO_RUN)
 {
     try {
         $this->producer->useTube($tube)->put($this->serializer->serialize($command), $priority, $delay, $timeToRun);
     } catch (Exception $exception) {
         $this->handlePutFailure($exception, $command);
     }
 }
Exemple #2
0
 /**
  * @param array $params
  * @dataProvider queueParamsProvider
  */
 public function testQueueClosure_queues(array $params)
 {
     $closure = function () {
         $this->fail('Should not be executed');
     };
     $testData = 'test';
     $this->serializerMock->expects($this->once())->method('serialize')->with($this->isInstanceOf(ClosureCommand::class))->willReturn($testData);
     $invocationMocker = $this->producerMock->expects($this->once())->method('put');
     call_user_func_array([$invocationMocker, 'with'], array_merge([$testData], $params));
     call_user_func_array([$this->qMan, 'queueClosure'], array_merge([$closure, self::TEST_TUBE], $params));
 }
Exemple #3
0
 /**
  * @param BeanieJob $beanieJob
  * @return Job
  */
 public function createJobFromBeanieJob(BeanieJob $beanieJob)
 {
     return new Job($beanieJob, $this->commandSerializer->unserialize($beanieJob->getData()));
 }