Beispiel #1
0
 public function enqueueJob($delay, $job, array $data = array(), $queue = null)
 {
     return \Resque::later($delay, $job, $data, $queue);
 }
Beispiel #2
0
            $job = Resque::push('FailLong', array());
            break;
        case 'failexception':
            $job = Resque::push('FailException', array());
            break;
        case 'failerror':
            $job = Resque::push('FailError', array());
            break;
        case 'closure':
            $job = Resque::push(function ($job) {
                echo 'This is an inline job! #' . $job->getId() . PHP_EOL;
            });
            break;
        case 'closure-delayed':
            $job = Resque::later(mt_rand(0, 30), function ($job) {
                echo 'This is a delayed inline job! #' . $job->getId() . PHP_EOL;
            });
            break;
    }
}
if ($job) {
    header('Location: ?id=' . $job->getId());
    exit;
}
echo '<pre><h1><a href="?">php-resque</a></h1><ul>' . '<li><a href="?action=reset">Reset</a></li>' . '<li><a href="?action=push">Push new job</a></li>' . '<li><a href="?action=delayed">Delayed job</a></li>' . '<li><a href="?action=delayedat">Delayed job in 2 mins</a></li>' . '<li><a href="?action=longrunning">Long running job</a></li>' . '<li><a href="?action=faillong">Fail due to running too long</a></li>' . '<li><a href="?action=failnoclass">Fail due to no class being found</a></li>' . '<li><a href="?action=failexception">Fail due to exception</a></li>' . '<li><a href="?action=failerror">Fail due to fatal error</a></li>' . '<li><a href="?action=closure">Push closure</a></li>' . '<li><a href="?action=closure-delayed">Delayed closure</a></li>' . '</ul>';
$rep = 150;
echo str_repeat('=', $rep) . PHP_EOL;
echo 'Resque stats:  ' . json_encode(Resque::stats()) . PHP_EOL;
echo 'Hosts:         ' . json_encode(Resque\Redis::instance()->smembers('hosts')) . PHP_EOL;
echo 'Workers:       ' . json_encode(Resque\Redis::instance()->smembers('workers')) . PHP_EOL;
echo 'Queues:        ' . json_encode(Resque\Redis::instance()->smembers('queues')) . PHP_EOL;