-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Add --exclude-queues
consume parameters
#60979
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: 7.4
Are you sure you want to change the base?
Conversation
@Kocal 🎁 |
src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php
Outdated
Show resolved
Hide resolved
52da22d
to
04d44be
Compare
--exclude-queues
consume parameters
3ca4340
to
3379fda
Compare
@Kocal @jbdelhommeau Not sure about the naming of the option guys. By default the command consumes from There is the option So I guess we could have 2 options:
Starting with the second option sounds more appropriate to me as it's not bound to some protocol/technologies. Also the current implementation is about |
3379fda
to
dcde172
Compare
I just push an new version more aligned with @B-Galati feedbacks. |
dcde172
to
4677777
Compare
@@ -77,6 +77,7 @@ protected function configure(): void | |||
new InputOption('queues', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Limit receivers to only consume from the specified queues'), | |||
new InputOption('no-reset', null, InputOption::VALUE_NONE, 'Do not reset container services after each message'), | |||
new InputOption('all', null, InputOption::VALUE_NONE, 'Consume messages from all receivers'), | |||
new InputOption('exclude-transports', 'et', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Exclude specific receivers/transports from consumption (can only be used with --all)'), |
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 previous conversation, the option --receivers
describes which receivers/transports to consume, but here --exclude-transports
describes which receivers/transports to not consume.
I feel like we should either have --receivers
and --exclude-receivers
, or --transports
and --exclude-transports
, but not both mixed.
I think the best option here is to go with --exclude-receivers
(like your initial suggestion 😇).
This PR adds a new
--exclude-transports
(shortcut-et
) option to themessenger:consume
command. This option allows users to exclude specific transports/receivers from being consumed when using the--all
flag.What it does and why it's needed:
messenger:consume --all
, you may want to skip certain transports (example the failed transports) without having to list all the others manually. The new--exclude-transports
option makes this possible.How it works:
This will consume messages from all transports except
queues1
andqueues2
.Behavior:
--exclude-queues
option can only be used with--all
. If used without--all
, anInvalidOptionException
is thrown.RuntimeException
is thrown to prevent running the command with no receivers.Before:
--all
.After:
--exclude-transports
when using--all
.Tests: