In modern Laravel apps, queues are mission-critical. They handle everything from sending emails and processing images to syncing data and triggering notifications. But what happens when your queue driver — Redis, SQS, or database — goes down?
Laravel 12 introduces a game-changing feature: the Queue Failover Driver. It’s designed to keep your jobs alive, even when your infrastructure stumbles.
Let’s explore how it works, why it matters, and how to implement it with real-world examples.
⚙️ What Is the Queue Failover Driver?
The failover driver allows you to define a prioritized list of queue connections. If the first one fails, Laravel automatically falls back to the next — no manual intervention, no job loss.
🔁 How It Works
Laravel attempts to push the job to the first connection. If it throws an exception (e.g., Redis is down), Laravel catches it and tries the next connection in the list.
This is ideal for:
- High-availability systems
- Multi-region deployments
- Hybrid cloud setups (e.g., Redis + SQS)
🛠️ Configuration Example
In config/queue.php, define a new connection:
'connections' => [
'resilient' => [
'driver' => 'failover',
'connections' => ['redis', 'sqs', 'database'],
],
],
This setup tries Redis first, then SQS, and finally falls back to the database queue.
📦 Dispatching Jobs with Failover
Use the failover connection like any other:
dispatch(new SendWelcomeEmail($user))->onConnection('resilient');
Laravel handles the fallback logic automatically.
🧪 Real-World Scenario: Redis Crash During a Product Launch
Imagine you’re launching a new feature and Redis crashes under load. Without failover, queued jobs stall — emails don’t send, notifications fail, users get frustrated.
With failover:
- Jobs reroute to SQS or database instantly
- No downtime
- No lost revenue
- You can fix Redis later without firefighting
🔍 Monitoring Failover Events
Want to know when failover kicks in? Use Laravel’s event system:
Event::listen(JobFailed::class, function ($event) {
Log::warning('Job failed on primary queue. Failover may have triggered.', [
'job' => $event->job,
'exception' => $event->exception,
]);
});
You can also track queue usage with Laravel Horizon or custom metrics.
🧠 Pro Tips for Production
- Use Redis for speed, SQS for durability, and database as a last resort
- Monitor queue latency across all drivers
- Set up alerts when failover is triggered
- Use batching and retries to smooth out spikes
🔐 Security & Reliability
Failover doesn’t compromise job integrity. Laravel ensures:
- Jobs are only pushed once
- Exceptions are logged
- You maintain full visibility across all drivers
🚀 Final Thoughts
Laravel’s Queue Failover Driver is a quiet revolution. It brings enterprise-grade resilience to background processing — without adding complexity.
If you’re building SaaS platforms, real-time apps, or anything mission-critical, this feature is a must-have in 2025.
