示例#1
0
 function do_post_testcancelphp_continuation_v1($job, $resp)
 {
     // we have do_post with a continuation of do_finish.  The do_finish
     // is only called via on-completion handler for do_run
     $run = $this->job_manager()->job("do_run_testcancelphp_continuation_v1");
     $finish = new Job($job);
     $finish->name("do_finish_testcancelphp_continuation_v1");
     $run->on(Job::EVENT_COMPLETED, $finish);
     $this->afterwards($run);
     return Worker::WORKER_CONTINUE;
 }
示例#2
0
 function do_get_testchainedphp_hello_v1($job, $resp)
 {
     $content = json_encode("Hello from job");
     // do internal hello1 which just appends it name to our content
     $j = new Job($job);
     $j->name("do_get_internalphp_hello1_v1");
     $j->type(Job::JOB_SYNC);
     $j->content($content);
     $r = $j->run();
     // create sync http rest job back to localhost which takes
     // the output from previous job and adds its own name.
     $j = $this->job_manager()->job(HttpClient::METHOD_POST, $job->base_uri() . "/hello2");
     $j->content($r->content());
     $j->headers($r->headers());
     $r = $j->run();
     $resp->content($r->content());
     $resp->headers($r->headers());
     return Worker::WORKER_SUCCESS;
 }
示例#3
0
 /**
  * @param Job $job
  *
  * @return bool
  */
 public function equals(Job $job)
 {
     return $this->name() === $job->name() && $this->arguments() === $job->arguments();
 }