使Laravel事件订阅者入队 [英] Enqueue laravel event subscriber

查看:199
本文介绍了使Laravel事件订阅者入队的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过事件订阅服务器处理多个事件,而不是制作单独的事件/侦听器.我想参加其中的几项活动,但是我没有找到实现此目的的方法.我遵循了官方文件 ( https://laravel.com/docs/5.2/events#event-subscribers),但是不知道如何选择我要入队的事件(所有订户都没有).

I'm handling multiple events through an Event Subscriber instead making separated Events/Listeners. I would like to enqueue several of these events but I didn't find a way to accomplish that. I've followed the official documentation (https://laravel.com/docs/5.2/events#event-subscribers), but there is no clue of how to choose what events I want to enqueue(neither all the subscriber).

有什么建议吗? (请没有个人事件/听众)

Any suggestions? (No individual Event/Listener, please)

提前谢谢!

推荐答案

如果有人对此感兴趣,我在Event Dispatcher中发现了更深入的解决方案.

If anyone is interested in, I've found the solution looking deeper in the Event Dispatcher.

在EventSubscriber上实现合同ShouldQueue的工作原理与单独的Event/Listener相同,并在数据库中排队事件.这应该记录在官方网站上.

Implementing the contract ShouldQueue on the EventSubscriber works the same than a separated Event/Listener and enqueue the events on the database. This should be documented in the official site.

致谢.

这篇关于使Laravel事件订阅者入队的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆