<?php $checked = @$_GET['async'] ? 'checked="true"' : null; ?> <input type="checkbox" name="async" value="1" <?php echo $checked; ?> /> run async? </p> <input type="submit" value="run it" /> </fieldset> </form> <?php if (!empty($_GET['resultMode'])) { $job = new TestJob(); $job->mode = $_GET['resultMode']; $job->wait = @$_GET['wait'] ? $_GET['wait'] : 0; $job->queue(); if (isset($_GET['async'])) { p($job->fire(), "The jobs uuid"); p($job->getResult(), "The result of the async job"); } else { try { p($job->block(), "Result. The job is returning: {$_GET['resultMode']}"); } catch (Exception $e) { p($e, "the job threw an exception and we carried it over to the client"); } } p($job, "The whole job"); $e = $job->getResponse()->getException();
protected function pushJobToQueue($data = 'test', $delay = 0) { $job = new TestJob(['data' => $data]); return $job->push($delay); }
<?php require_once 'TestJob.php'; require_once 'Resqee.php'; require_once 'config.php'; require_once 'Resqee/Job.php'; require_once 'Resqee/Persistence/MySQL.php'; $job = new TestJob(); $ids = array(); p('jobIds below', "calling fire twice"); $id = $job->fire("fire 1 & \"quote me\" \\ "); //p($job->getResponse($id)); p("fire 1 jobId: {$id}"); $ids[] = $id; $id = $job->fire('fire 2'); p("fire 2 \"&jobId: {$id}"); $ids[] = $id; p($job->block('im a blocking job'), "result of blocking job"); p($job->block(), "result of blocking job with NO ARGUMENTS"); foreach ($ids as $jobId) { p($job->getResult($jobId), "result for {$jobId}"); } p("", 'gonna queue 2 jobs and fire them'); $ids = array(); $ids[] = $job->queue("queued job 1"); $ids[] = $job->queue("queued job 2"); foreach ($ids as $jobId) { p($job->getResult($jobId), "result for queued job {$jobId}"); } p($job, "the whole job"); p($job->getResponses(), "all responses");