Framework: ShouldQueue and Queueable in Listeners

Created on 14 Mar 2017  路  5Comments  路  Source: laravel/framework

  • Laravel Version: 5.3
  • PHP Version: 7.1
  • Redis Queue

Description:

Hello to everyone.
I have an event with several Listeners. The ShouldQueue interface work well on Listeners, but the listeners can't work with Queueable trait (delay, different queue), is this a bug or a feature?

I know that I can use jobs for delaying. But in my perspective, every class that allows to implement ShouldQueue should also work with Queueable (the ability to be delayed).

Most helpful comment

Queueable can be used while dispatching a job since you have access to the job object to call Queueable's methods on, but listeners are created internally.

I Just submitted a PR that should add the functionality https://github.com/laravel/framework/pull/18375

All 5 comments

The linked issue is about moving scheduled jobs to the queue, not event listeners.

Actual related issue: https://github.com/laravel/framework/issues/18199

Sorry I didn't find the issue before.
Thanks @sisve
It would be good to have this feature.

Queueable can be used while dispatching a job since you have access to the job object to call Queueable's methods on, but listeners are created internally.

I Just submitted a PR that should add the functionality https://github.com/laravel/framework/pull/18375

Thanks, @themsaid

Was this page helpful?
0 / 5 - 0 ratings