Resque_Worker::find PHP Method

find() public static method

Given a worker ID, find it and return an instantiated worker class for it.
public static find ( string $workerId ) : Resque_Worker
$workerId string The ID of the worker.
return Resque_Worker Instance of the worker. False if the worker does not exist.
    public static function find($workerId)
    {
        if (!self::exists($workerId) || false === strpos($workerId, ":")) {
            return false;
        }
        list($hostname, $pid, $queues) = explode(':', $workerId, 3);
        $queues = explode(',', $queues);
        $worker = new self($queues);
        $worker->setId($workerId);
        return $worker;
    }

Usage Example

Beispiel #1
0
 public function testGetWorkerById()
 {
     $worker = new Resque_Worker('*');
     $worker->registerWorker();
     $newWorker = Resque_Worker::find((string) $worker);
     $this->assertEquals((string) $worker, (string) $newWorker);
 }
All Usage Examples Of Resque_Worker::find