jeudi 26 novembre 2015

Laravel 5 / L5: Set number of attempts when pushing job to a queue using Database connection

I have setup the Queue system in L5 using the Databse connection and after i run the migration I have two tables in my DB failed_jobs and jobs. Everything is working fine so far but when the pushed operation failed its keep going and trying to process the operation and did not delete the job on fail or inserted on failed_jobs

 Queue::push(function($job) use ($id)
 {
     Account::delete($id);

     $job->delete();
 });

In the above example how can I set number of attempts to try if not success and then insert into failed_jobs.

I know this can be done using

php artisan queue:listen --tries=3

But I want the same using the Closures as I have different cases



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire