Laravel
Beginner
1 min read
Queue Workers, Redis, and Horizon
Example
# config/queue.php — use Redis driver
# 'default' => env('QUEUE_CONNECTION', 'redis'),
# Install Horizon
# composer require laravel/horizon
# php artisan horizon:install
# php artisan migrate
# config/horizon.php (simplified)
# 'environments' => [
# 'production' => [
# 'supervisor-1' => [
# 'connection' => 'redis',
# 'queue' => ['high', 'default', 'low'],
# 'balance' => 'auto',
# 'processes' => 10,
# 'tries' => 3,
# 'memory' => 128,
# ],
# ],
# ],
# Start Horizon (foreground)
php artisan horizon
# Pause / continue without killing process
php artisan horizon:pause
php artisan horizon:continue
# List failed jobs
php artisan queue:failed
# Retry a specific failed job
php artisan queue:retry <job-id>
# Retry all failed jobs
php artisan queue:retry all
# Flush all failed jobs
php artisan queue:flush
# Process jobs from a specific queue
php artisan queue:work redis --queue=high,default --tries=3 --sleep=3
Related Resources
Laravel Reference
Complete tag & property list
Laravel How-To Guides
Step-by-step practical guides
Laravel Exercises
Practice what you've learned
More in Laravel