예제 #1
0
 public function testWorkerDoesNotWorkOnUnknownQueues()
 {
     return $this->markTestIncomplete();
     $queueOne = new RedisQueue($this->redis);
     $queueOne->setName('queue1');
     $queueTwo = new RedisQueue($this->redis);
     $queueTwo->setName('queue2');
     $queueTwo->push(new Job('Test_Job'));
     $this->worker->addQueue($queueOne);
     $this->assertNull($this->worker->reserve());
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 public function createWorkerFromId($workerId)
 {
     if (false === strpos($workerId, ":")) {
         return null;
     }
     list($hostname, $pid, $queues) = explode(':', $workerId, 3);
     $queues = explode(',', $queues);
     if (!$queues) {
         throw new ResqueRuntimeException(sprintf("Invalid worker ID \"%s\"", $workerId));
     }
     $worker = new Worker($this->jobInstanceFactory, $this->eventDispatcher);
     $worker->setHostname($hostname);
     $process = new Process($pid);
     // @todo When worker is on another host, Process is over kill.
     $worker->setProcess($process);
     foreach ($queues as $queue) {
         $worker->addQueue($this->queueFactory->createQueue($queue));
         // @todo what about wildcard queues? :(
     }
     return $worker;
 }