Laravel Queue and Job

Official Doc:

Command to build job class:

php artisan make:job SendReminderEmail

Command to dispatch job:

dispatch(new FakePriceData(10));

Command to execute start queue worker:

php artisan queue:work database --queue=daemon --tries=3

For Laravel 5.2 or older version

//Process the first job only
php artisan queue:work

//Continue to process all jobs
php artisan queue:listen

Run queue worker in background

//Execute queue in background
nohup php artisan queue:work --daemon > storage/logs/nohup_queue.log 2>&1 &

//Find existing nohup jobs
jobs -l

//Kill nohup process
kill -9 12345


  • Every time related scripts are changed, the queue worker must be restarted or the job will always read the script in some cache.
  • Don’t use database to save queue data. Performance is bad and there must be some bugs during data conversion. Some data could be missing when sending emails.