config/queue.php
2018-10-29 本文已影响9人
爱折腾的傻小子
- 队列配置文件源码
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
# sync PHP扩展
# database : 使用数据库保存队列数据
# beanstalkd
# sqs :亚马逊 简单队列服务 提供队列服务
# redis : redis 保存队列数据
# null : 不使用队列
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
# 队列database配置参数列表
'database' => [
'driver' => 'database', //> database 数据库服务
'table' => 'jobs', //> 队列所使用的表名称 jobs
'queue' => 'default', //> 默认队列名称default可以设置多个名称如default,mail
// 该配置项的目的是定义任务在执行以后多少秒后释放回队列。
// 如果retry_after 设定的值为 90, 任务在运行 90 秒后还未完成,那么将被释放回队列而不是删除掉。
// 毫无疑问,你需要把 retry_after 的值设定为任务执行时间的最大可能值
'retry_after' => 90, ],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
'queue' => 'your-queue-name',
'region' => 'us-east-1',
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
# 队列执行失败配置参数
'failed' => [
# 队列保存失败 链接数据库默认mysql
'database' => env('DB_CONNECTION', 'mysql'),
# 队列保存失败 保存数据库表 failed_jobs 中
'table' => 'failed_jobs',
],
];