Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Messenger] Add optionallow_no_senders to enable throwing when a message doesn't have a sender#46053
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Messenger] Add optionallow_no_senders to enable throwing when a message doesn't have a sender#46053
Uh oh!
There was an error while loading.Please reload this page.
Conversation
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
Let's conclude our discussion about naming. Here is my view.
src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| ->children() | ||
| ->enumNode('default_middleware') | ||
| ->values([true,false,'allow_no_handlers']) | ||
| ->values([true,false,'allow_no_handlers','throw_no_routing']) |
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.
Why not adding as a proper boolean node underbuses, since these values are mutually exclusive?
That would allow the option to also be used as arg when using theSendMessageMiddleware without the defaults.
allow_no_senders to enable throwing when a message doesn't have a senderThere 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.
I updated the PR title with what looks best to me. Please upgrade the line in the changelog if you're OK with it.
| ->children() | ||
| ->enumNode('default_middleware') | ||
| ->values([true,false,'allow_no_handlers']) | ||
| ->values([true,false,'allow_no_handlers','allow_no_senders']) |
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.
Following the comment from@HeahDude, I think it would be nice to turn this default_middleware option into an array node:
->arrayNode('default_middleware') ->canBeDisabled() ->children() ->booleanNode('allow_no_handlers')->defaultFalse()->end() ->booleanNode('allow_no_senders')->defaultTrue()->end()
With an appropriatebeforeNormalization() closure to turn the old configs into the new one.
WDYT?
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.
But then there would be conflict betweenallow_no_handlers andenabled: true that would need proper handling.
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.
which conflict? "enabled" would be about "default_middleware", not about allow_no_handlers
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.
I mean, in your example, usingallow_no_handlers requiresdefault_middleware to beenabled: false, hence the current enum as they are mutually exclusive.
nicolas-grekasSep 14, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 requiresenable: true yes. enabled/disabled applies to a whole subnode, there's nothing specific to this node here. If you define this, then of courseallow_no_handlers is going to be ignored:
default_middleware: enable: false allow_no_handlers: trueUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsdShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
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.
Just minor things, but LGTM thanks.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Do we want to set it to |
…essage doesn't have a sender
Thank you@babeuloula. |
…rs` (babeuloula)This PR was merged into the 6.2 branch.Discussion----------[Messenger] Add documentation for `allow_no_senders`Hello,There is the documentation for my PRsymfony/symfony#46053.Fixsymfony#17378Have a nice day.Commits-------4d7398fsymfony#17378: Add documentation for allow_no_senders
Uh oh!
There was an error while loading.Please reload this page.
Hello,
For my first contribution to the Symfony community I would like to propose this feature.
On my projects, sometimes I forget to update the messenger.yaml file and I don't have a routing for my new message. If you don't set the entry on the
routingsection, the message will be dispatch like if you use sync://.In order to don't forget to add the entry, I've update the
SendMessageMiddlewaremiddleware to throw an exception.For the documentation, I never work with rst file, so if someone would help me, i will very appreciate.
Thanks.