public function executeOutstandingJobs()
 {
     $queues = $this->queueRegistry->all();
     foreach ($queues as $queue) {
         $this->processQueueJobs($queue);
     }
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new SymfonyStyle($input, $output);
     $queues = $this->queueRegistry->all();
     $tableInput = array();
     foreach ($queues as $queue) {
         $tableInput[] = array($queue->getName(), $queue->count());
     }
     $output->table(array('Name', 'Outstanding jobs'), $tableInput);
 }
예제 #3
0
 function it_dequeues_jobs_from_all_queues(QueueRegistryInterface $registry, QueueInterface $queueBaz, QueueInterface $queueFoo, JobInterface $jobBaz, JobInterface $jobFoo)
 {
     $registry->all()->willReturn([$queueBaz, $queueFoo]);
     $queueBaz->dequeue()->shouldBeCalled(1)->willReturn($jobBaz);
     $this->dequeue()->shouldReturn($jobBaz);
     $queueBaz->dequeue()->shouldBeCalled(1)->willReturn(null);
     $queueFoo->dequeue()->shouldBeCalled(1)->willReturn($jobFoo);
     $this->dequeue()->shouldReturn($jobFoo);
     $queueBaz->dequeue()->shouldBeCalled(1)->willReturn(null);
     $queueFoo->dequeue()->shouldBeCalled(1)->willReturn(null);
     $this->dequeue()->shouldReturn(null);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new SymfonyStyle($input, $output);
     $queue = $this->queueFactory->createQueue($input->getArgument('queue'));
     //        if ($input->isInteractive()) {
     //            if (!$output->confirm(sprintf('you sure?', $queue->getName()), false)) {
     //                return;
     //            }
     //        }
     $this->queueRegistry->register($queue);
     // @todo should this be here?
     $job = new Job($input->getArgument('target'));
     // @todo remove new Job.
     if ($queue->enqueue($job)) {
         $output->success('Enqueued job "' . $job->getJobClass() . '" with arguments, to queue "' . $queue->getName() . '"');
     }
 }
예제 #5
0
 public function testAllReturnsRegisteredQueues()
 {
     return $this->markTestIncomplete();
     $queues = $this->registry->all();
     $this->assertCount(0, $queues);
     $foo = $this->registry->createQueue('foo');
     $this->registry->register($foo);
     $queues = $this->registry->all();
     $this->assertCount(1, $queues);
     $this->assertEquals('foo', $queues['foo']);
     $bar = $this->registry->createQueue('bar');
     $this->registry->register($bar);
     $queues = $this->registry->all();
     $this->assertCount(2, $queues);
     $this->assertNotContains($foo, $queues);
     $this->assertNotContains($bar, $queues);
 }
예제 #6
0
 protected function setupQueues()
 {
     if (null === $this->queues) {
         $configQueues = explode(',', $this->config['queues']);
         $queues = array();
         if (in_array('*', $configQueues)) {
             $wildcard = new \Resque\Component\Queue\WildcardQueue($this->queueRegistry);
             $queues[] = $wildcard;
         } else {
             foreach ($configQueues as $configQueue) {
                 $queues[] = $this->queueRegistry->createQueue($configQueue);
             }
         }
         $this->queues = $queues;
     }
 }