-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Consume a PSR-14 dispatcher for dispatching events #45967
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
Conversation
3fcc3d5
to
c3eedbf
Compare
c3eedbf
to
a7794bb
Compare
src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php
Outdated
Show resolved
Hide resolved
a7794bb
to
5e04bf4
Compare
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php
Outdated
Show resolved
Hide resolved
@@ -18,6 +18,7 @@ | |||
"require": { | |||
"php": ">=7.2.5", | |||
"psr/log": "^1|^2|^3", | |||
"psr/event-dispatcher": "^1", |
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 is technically only required if using the queue parts of the library, I think. If it's purely a sync message bus it's not required. That suggests it may be better as a suggests/dev.
PSR packages are small enough that it doesn't really matter, but it's worth mentioning as event-dispatcher wasn't in a first-level require. I'm comfortable either way.
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 was, because we could have Symfony's EventDispatcher contracts v1 installed which extended the PSR-14 interface conditionally (= only if it's present), mainly because of PHP 7.1 compatibility (PSR-14 requires PHP 7.2).
I have pushed a new version that should work even in that combination, which allowed me to remove the dependency again.
5e04bf4
to
a1213b0
Compare
a1213b0
to
f1169bb
Compare
That's a new feature, and as such, it should target 6.1 (we merged the same for Mailer as a new feature as well). |
f1169bb
to
78603d0
Compare
All right. That makes it a lot easier. 😅 |
78603d0
to
f500c7a
Compare
Thank you @derrabus. |
As @Crell said in #45963, requiring the event dispatcher passed to those classes to be an implementation of Symfony's contract was too restrictive. We can easily consume a PSR-14 dispatcher here.
This PR obviously only fixes the low hanging fruit. The commands coming with the messenger component register event subscribers on the dispatcher, in a way that we need the actual EventDispatcher component for.