php-kue icon indicating copy to clipboard operation
php-kue copied to clipboard

request update README.md: how to report succes/failure of job when processing

Open coderofsalvation opened this issue 10 years ago • 3 comments

It seems this project is more complete than the README.md suggests :)

Please add this snippet to README.md:

Job failure / progress

// Process the `email` type job
$kue->on('process:email', function($job){
    $data = $job->data
    $job->progress(50); // communicate progress to queue 1..100
    if( ! mail($data['to'], $data['subject'], $data['body']) ){
        // uncaught exception will mark a job as failed and/or increase its attempt-variable
        throw new Exception("FOO_BAR");
    }
});

optionally you can call the following to modify the job status directly:

  • $job->failed()
  • $job->complete()
  • $job->inactive()
  • $job->active()

coderofsalvation avatar Jun 09 '15 07:06 coderofsalvation

OK, thanks a lot, And you can give me a PR to become the contributor of php-kue.

hfcorriez avatar Jun 09 '15 07:06 hfcorriez

done: https://github.com/hfcorriez/php-kue/pull/3

coderofsalvation avatar Dec 29 '15 17:12 coderofsalvation

Need to merge!

maZahaca avatar Aug 12 '16 11:08 maZahaca