Horizon Queues
Queue Flow
Section titled “Queue Flow”Horizon Configuration
Section titled “Horizon Configuration”'environments' => [ 'production' => [ 'supervisor-1' => [ 'connection' => 'redis', 'queue' => ['default', 'high', 'low'], 'balance' => 'auto', 'minProcesses' => 1, 'maxProcesses' => 10, 'balanceMaxShift' => 1, 'balanceCooldown' => 3, 'tries' => 3, 'timeout' => 60, ], ],],Queue Priority
Section titled “Queue Priority”// High priority - payment processingdispatch(new ProcessPayment($order))->onQueue('high');
// Default - email notificationsdispatch(new SendWelcomeEmail($user));
// Low priority - analyticsdispatch(new UpdateMetrics($data))->onQueue('low');Supervisor Integration
Section titled “Supervisor Integration”Horizon runs as a Supervisor process:
[program:horizon]command=/usr/bin/php /var/www/html/artisan horizonautostart=trueautorestart=trueuser=www-datastopwaitsecs=3600stopwaitsecs=3600 allows jobs up to 1 hour to complete during deployment.
Monitoring
Section titled “Monitoring”Access Horizon dashboard at /horizon. Shows:
- Active/pending/completed jobs
- Failed jobs with exception details
- Throughput metrics
- Worker status
Failed Job Handling
Section titled “Failed Job Handling”// Retry all failed jobsphp artisan horizon:forget
// Retry specific jobphp artisan queue:retry {job-id}
// Clear failed jobsphp artisan queue:flushGraceful Shutdown
Section titled “Graceful Shutdown”On deployment, Horizon receives SIGTERM:
- Stops accepting new jobs
- Completes in-progress jobs (up to stopwaitsecs)
- Exits cleanly
New container starts fresh Horizon process.