-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Require default_bus with multiple buses #31624
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
Comments
@weaverryan Maybe we can also just modify this line : symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php Line 1648 in 5dba412
Changing the condition from : if (null === $config['default_bus'] && 1 === \count($config['buses'])) {
$config['default_bus'] = key($config['buses']);
} to if (null === $config['default_bus']) {
$config['default_bus'] = key($config['buses']);
} Then the default bus will be the first declared. WDYT 🤔 ? |
Hmm... I kinda like the idea of forcing the user to be explicit - an exception would almost be a built-in README to communicate that the user needs to choose one bus as their main bus, instead of not realizing that it's happening. |
Same as @weaverryan. We deprecated a similar behavior for security user providers which was to take the first defined provider in favor of explicitly defining the provider on a single firewall/listener. |
Ok I understand. I've made the PR to add a validation |
…ion (vincenttouzet) This PR was merged into the 4.3 branch. Discussion ---------- [FrameworkBundle] Add a validation on the messenger section | Q | A | ------------- | --- | Branch? | 4.3 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31624 <!-- #-prefixed issue number(s), if any --> | License | MIT <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Commits ------- 36f16e8 [FrameworkBundle] Add a validation on the messenger section
Symfony version(s) affected: 4.3
Description
At least in 4.3, if you have multiple messenger buses, you need to specify
framework.messenger.default_bus
. If you do not, you'll get:How to reproduce
Add
framework.messenger.buses
with two entries below, but do not specifyframework.messenger.default_bus
.Possible Solution
In the FrameworkBundle Configuration class, we should probably add validation to throw a better message.
The text was updated successfully, but these errors were encountered: