Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function delayed($queue, $delay, Job $job)
 {
     $options = $job->getOptions();
     $options['delay'] = $delay;
     $job->setOptions($options);
     return $this->push($queue, $job);
 }
Пример #2
0
 /**
  * @covers ::__construct
  * @covers ::createFromPayload
  */
 public function testConstruct()
 {
     $job = new Job('Fake\\Class', ['data'], ['options'], ['extras']);
     $this->assertEquals('Fake\\Class', $job->getJob());
     $this->assertEquals(['data'], $job->getData());
     $this->assertEquals(['options'], $job->getOptions());
     $this->assertEquals(['extras'], $job->getExtras());
     $job = Job::createFromPayload($job->createPayload());
     $this->assertEquals('Fake\\Class', $job->getJob());
     $this->assertEquals(['data'], $job->getData());
     $this->assertEquals(['extras'], $job->getExtras());
 }
Пример #3
0
 /**
  * Prepares a message
  *
  * @param string $queue
  * @param Job    $job
  *
  * @return AMQPMessage
  *
  * @codeCoverageIgnore
  */
 protected function prepareMessage($queue, Job $job)
 {
     $this->queueDeclare($queue);
     return new AMQPMessage(json_encode($job->createPayload()), $job->getOptions());
 }