Laravel Queue & Job System: From Table Creation to Production Deployment
July 1, 2025🚀 Laravel Queue & Job System
We’re gonna walk you through Laravel queues from setup to deploying in production using Supervisor.
Step 1: Create queue tables
Run these commands:
php artisan queue:table
php artisan queue:failed-table
php artisan queue:batches-table
php artisan migrate
Step 2: Monitor failed jobs
Run:
php artisan queue:failed
You’ll get a list with ID, connection, exception, and timestamp.
Step 3: Retry failed jobs
php artisan queue:retry 5 # retry single job
php artisan queue:retry all # retry all failed jobs
Step 4: Delete failed jobs
php artisan queue:flush
Step 5: Prune old failed jobs
php artisan queue:prune-failed # older than 24h
php artisan queue:prune --hours=48 # older than 48h
Step 6: Retry logic with backoff
Examples:
php artisan queue:work --tries=2
php artisan queue:work --queue=notification --tries=2 --backoff=1200
php artisan queue:work --queue=notification --tries=2 --backoff=10,20
Step 7: Job batches
Use batches to group jobs (e.g., sending 10,000 emails) and track overall progress, retries, and notifications.
Step 8: Production deployment with Supervisor
Supervisor restarts your queue workers on failure. Example config:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work --tries=3 --backoff=30 --timeout=120 --max-jobs=1000 --max-time=3600 --sleep=3 --reset=1
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-worker.log
Save to /etc/supervisor/conf.d/laravel-worker.conf
, then:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-worker:*
Blog
Mastering Laravel 12 Conditional Validation
Jul 07, 2025
Mastering Laravel 12 Conditional Validation Laravel 12's validation system is super powerful, and conditional validation makes your forms...
Laravel 12.18.0 Update
Jun 17, 2025
Laravel 12.18.0 Update The Laravel team released version 12.18.0 with several cool updates: String encrypt() & decrypt() helpers are...
Object-Oriented Programming (OOP) – Core Concepts
Aug 09, 2025
Object-Oriented Programming (OOP) is a modern software development approach that divides an application into units called Objects that interact with...
Essential React Native UI & Interaction Components
Jul 01, 2025
Essential React Native UI & Interaction Components React Native provides a powerful set of built-in components for creating native mobile apps....
Bypassing $fillable Safely with forceFill() in Laravel
Jul 02, 2025
Bypassing $fillable Safely with forceFill() in Laravel Ever used create() in Laravel and noticed some fields like role or status didn’t save? T...
What’s New in ECMAScript 2025
Jun 30, 2025
What’s New in ECMAScript 2025 On June 25, 2025, Ecma International officially approved ES2025, adding several useful features: 1. 📦 Import At...
