Skip to content

Commit 0f183b4

Browse files
committed
failover docs
1 parent 387eeee commit 0f183b4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

queues.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [Customizing The Queue and Connection](#customizing-the-queue-and-connection)
2222
- [Specifying Max Job Attempts / Timeout Values](#max-job-attempts-and-timeout)
2323
- [SQS FIFO and Fair Queues](#sqs-fifo-and-fair-queues)
24+
- [Queue Failover](#queue-failover)
2425
- [Error Handling](#error-handling)
2526
- [Job Batching](#job-batching)
2627
- [Defining Batchable Jobs](#defining-batchable-jobs)
@@ -1531,6 +1532,29 @@ $invoicePaid = (new InvoicePaid($invoice))
15311532
$user->notify($invoicePaid);
15321533
```
15331534

1535+
<a name="queue-failover"></a>
1536+
### Queue Failover
1537+
1538+
The `failover` queue driver provides automatic failover functionality when pushing jobs to the queue. If the primary queue connection fails for any reason, Laravel will automatically attempt to push the job to the next configured connection in the list. This is particularly useful for ensuring high availability in production environments where queue reliability is critical.
1539+
1540+
To configure a failover queue connection, specify the `failover` driver and provide an array of connection names to attempt in order:
1541+
1542+
```php
1543+
'failover' => [
1544+
'driver' => 'failover',
1545+
'connections' => [
1546+
env('QUEUE_CONNECTION', 'database'),
1547+
'sync',
1548+
],
1549+
],
1550+
```
1551+
1552+
Once you have configured a connection that uses the `failover` driver, you will probably want to set the failover connection as your default queue connection in your application's `.env` file:
1553+
1554+
```ini
1555+
QUEUE_CONNECTION=failover
1556+
```
1557+
15341558
<a name="error-handling"></a>
15351559
### Error Handling
15361560

0 commit comments

Comments
 (0)