简体   繁体   English

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

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

I am building an application with Laravel that receives notifications and then fires events to handle those notifications. 我正在使用Laravel构建一个接收通知的应用程序,然后触发事件来处理这些通知。 I want these events to be Queued so that only one event is handled at a time. 我希望将这些事件排队,以便一次只处理一个事件。

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. 我已经更改了config / queue.php中的默认驱动程序,因此将其设置为使用“数据库”,并且运行php artisan queue:table创建作业迁移,但是当我向应用程序发送通知时,我看不到任何迹象作业表或其他任何地方使用的队列数量。 What could be going wrong? 可能出什么问题了?

(My EventHandler class is using ShouldBeQueued as well) (我的EventHandler类也使用ShouldBeQueued)

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

QUEUE_DRIVER=database

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM