Laravel queue error
I was trying to write some data from another table when work orders fail. It works fine on the failed jobs table, but I can't seem to get it to Queue::failing(function($connection, $job, $data)
work every time the job fails. I tried to put it in global.php
but no luck.
Another question: what $job
does it return ? Object or just job ID?
source to share
You have to call queue: to work with --tries param, for example:
$ php artisan queue:work sqs --tries=1
Without these parameters, your work will never fail.
But don't forget to customize the error table.
1) Create a migration file:
$ php artisan queue:failed-table
2) Run migration to create table
$ php artisan migrate
3) In queue.php, you need to customize the error table. Example:
'failed' => array(
'database' => 'pgsql', 'table' => 'failed_jobs',
),
Now, when the job failed, it will be inserted into the fail_jobs table.
Just run php artisan queue:failed
to get the error list.
source to share