你如何为 Laravel 5 设置数据库队列驱动程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30245490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:33:39  来源:igfitidea点击:

How do you set up the database Queue driver for Laravel 5?

phpdatabaselaravelqueuelaravel-5

提问by erichie

I am building an application with Laravel that receives notifications and then fires events to handle those notifications. I want these events to be Queued so that only one event is handled at a time.

我正在使用 Laravel 构建一个应用程序,该应用程序接收通知然后触发事件来处理这些通知。我希望将这些事件排队,以便一次只处理一个事件。

I've been trying to use the "database" Queue driver that the documentation says is available. I've changed the default driver in config/queue.php so it is set to use "database" and I ran php artisan queue:table to create the jobs migration but when I send a notification to the app I do not see any sign of queues being used in the jobs table or anywhere else. What could be going wrong?

我一直在尝试使用文档中说可用的“数据库”队列驱动程序。我已经更改了 config/queue.php 中的默认驱动程序,因此它被设置为使用“数据库”,并且我运行了 php artisan queue:table 来创建作业迁移,但是当我向应用程序发送通知时,我没有看到任何迹象在作业表或其他任何地方使用的队列。可能出什么问题了?

(My EventHandler class is using ShouldBeQueued as well)

(我的 EventHandler 类也在使用 ShouldBeQueued)

采纳答案by Hrishikesh Mishra

In your .envfile, you have to add this.

在您的.env文件中,您必须添加它。

QUEUE_DRIVER=database