Exemple #1
0
 public function processBuffer()
 {
     $this->consumer_q->consume(function (IncomingMessage $message) {
         $content = $message->getContent();
         $queue_name = $this->config->getJobQueueConfig()->getWorkerQueueName($content['name'], $content['params'], $content['options']);
         $this->database->bufferJob($queue_name, ['name' => $content['name'], 'params' => $content['params'], 'options' => $content['options'], 'meta' => $content['meta']]);
         $message->acknowledge();
     });
 }
Exemple #2
0
 /**
  * @covers ::__construct
  * @covers ::getJobQueueConfig
  * @covers ::<private>
  * @dataProvider configProvider
  */
 public function testJobQueueConfigOptionsArePassedIn($options)
 {
     $config = new Config(__FILE__, $options);
     $job_queue_config = $config->getJobQueueConfig();
     $uniqid = uniqid();
     $this->assertSame($uniqid, $job_queue_config->getBufferQueueName($uniqid, [], []));
     $this->assertSame($uniqid, $job_queue_config->getWorkerQueueName($uniqid, [], []));
     $this->assertSame([$uniqid, ['value' => $uniqid]], call_user_func($job_queue_config->getJobRunnerFactory(), $uniqid, ['value' => $uniqid], []));
 }
 /**
  * @param  string $name
  * @param  array  $params
  * @param  array  $options
  * @return BufferQueue
  */
 public function getBufferQueueForJob($name, array $params, array $options)
 {
     $queue_name = $this->config->getJobQueueConfig()->getBufferQueueName($name, $params, $options);
     return $this->getQueue($queue_name);
 }