New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.x] Queued closure listeners #33463
Conversation
src/Illuminate/Events/functions.php
Outdated
* @param \Closure $closure | ||
* @return \Illuminate\Events\QueuedClosure | ||
*/ | ||
function queueable(Closure $closure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can side effect?
Can be like?;
if (! function_exists('queueable')) {
// method here
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's namespaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need the if method exists, actually. The function can still conflict with a global install of itself.
src/Illuminate/Events/functions.php
Outdated
* @param \Closure $closure | ||
* @return \Illuminate\Events\QueuedClosure | ||
*/ | ||
function queueable(Closure $closure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need the if method exists, actually. The function can still conflict with a global install of itself.
It is currently impossible to define a Closure based event listener that should also be queued. This adds that functionality.
This is also the first addition of a namespaced function to Laravel.
In addition,
catch
,onConnection
,onQueue
, anddelay
methods are available:This may also be used with model event listeners: