- 
                Notifications
    You must be signed in to change notification settings 
- Fork 402
Added support to specify a different implementation of the queue listener #1032
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
base: master
Are you sure you want to change the base?
Added support to specify a different implementation of the queue listener #1032
Conversation
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.
Co-authored-by: Will Power <[email protected]>
|  | ||
| Event::listen(AuditCustom::class, RecordCustomAudit::class); | ||
| Event::listen(DispatchAudit::class, ProcessDispatchAudit::class); | ||
| Event::listen(DispatchAudit::class, Config::string('audit.queue.listener', ProcessDispatchAudit::class)); | 
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.
@willpower232 hi, maybe an interface check, to prevent someone from setting up a class that is not a listener, or some non-existent class
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.
If we are going to have settable listeners, shouldn't RecordCustomAudit listener have the same option?
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.
@markieo1 what do you think about adding an option for the custom audit and then using class_exists and probably method_exists for handle? not sure there is an interface for event listeners
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 is a good option, another could be to create a new contract that requires having a handle method and validate that interface.
Hi,
As discussed in #1031, hereby the PR.
The code defaults to the
ProcessDispatchAudit. When a different implementation is provided ornull, Laravel uses this. Laravel already handles thenullcorrectly.Using it this way anyone can provide a custom listener implementation.