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 debug:messenger CLI command#26803
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ogizanagi commentedApr 4, 2018
One less PR to do on my list :) The tactician debug command looks like this: Tactician routing=================Bus: default------------ ----------------------------------------------------- ----------------- Command Handler Service ----------------------------------------------------- ----------------- League\Tactician\Bundle\Tests\Fake\FakeCommand a.handler League\Tactician\Bundle\Tests\Fake\OtherFakeCommand b.handler ----------------------------------------------------- ----------------- Would be great to have messages <-> handlers too here. |
| { | ||
| $this | ||
| ->setDefinition(array( | ||
| newInputArgument('search', InputArgument::OPTIONAL,'A search filter'), |
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.
Not convinced this is useful until we have more info to show about a message. A simplegrep is enough for this for now.
ro0NL commentedApr 4, 2018 • 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.
A message can have multiple handlers .. 🤔 Also the intend was concerning end users who mostly care about |
ogizanagi commentedApr 4, 2018
Wasn't the case with tactician, but it's not a problem here. Just show all associated handlers.
Would still be useful in this way :) |
| * file that was distributed with this source code. | ||
| */ | ||
| namespaceSymfony\Bundle\FrameworkBundle\Command; |
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.
Should be moved to the component like the other Messenger commands.
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.
Done.
ro0NL commentedApr 8, 2018
| $tableRows =array(); | ||
| foreach ($this->mappingas$message =>$handlers) { | ||
| $tableRows[] =array(sprintf('<fg=cyan>%s</fg=cyan>',$message)); | ||
| foreach ($handlersas$handler) { |
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 think that having the list of handlers in another column would make more sense and be more coherent with the rest of thedebug: commands as well.
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.
well.. i tookdebug:autowring for inspiration. IMHO that one reads well :)
Also with multiple columns we probably run into a spacing issue, assuming all service IDs are FQCN.
| $io =newSymfonyStyle($input,$output); | ||
| $io->title('Message Bus'); | ||
| $io->text('The following classes can be dispatch:'); |
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.
The following messages can be dispatched:
| { | ||
| $io =newSymfonyStyle($input,$output); | ||
| $io->title('Message Bus'); |
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.
Messenger
weaverryan commentedApr 21, 2018
Ido like the table layout mentioned above#26803 (comment) - it's just a bit easier to read. I realize that it's possible for a message to have several handlers. This is an edge-case, and I think we could handle that like this: ----------------------------------------------------- ----------------- Command Handler Service ----------------------------------------------------- ----------------- League\Tactician\Bundle\Tests\Fake\FakeCommand a.handler c.handler League\Tactician\Bundle\Tests\Fake\OtherFakeCommand b.handler ----------------------------------------------------- ----------------- |
sroze commentedApr 25, 2018
This PR needs to be updated following#26864 :) |
ro0NL commentedApr 28, 2018
Rebased. @sroze we cant group messages per bus as there's no such concept, so it's still a single list of messages. @weaverryan can you update the table example with handler services like |
weaverryan commentedApr 28, 2018
As we talked about, the table layout I suggested won’t work - class names are too long. So, the original format should be used, but probably with some added coloration to make it nice and clear :) |
sroze left a comment
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.
Looks good. Just two minor comments.
| <tagname="console.command"command="messenger:consume-messages" /> | ||
| </service> | ||
| <serviceid="console.command.messenger_debug"class="Symfony\Component\Messenger\Command\DebugMessengerCommand"> |
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.
All the commands are namedNameDebugCommand, notDebugNameCommand. Could you change it to be something consistent with the rest?
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.
All the commands exceptDebugAutowiringCommand.. which i took as a template 😅 now updated.
| protectedfunctionconfigure() | ||
| { | ||
| $this | ||
| ->setDescription('Lists classes you can dispatch using the message bus') |
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 suggest "message classes" or "messages" (as you say "The following messages [...]" in the output)
chalasr left a comment
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.
Looks good. A functional test case would have been nice, maybe could you just share a screenshot of the final output?
weaverryan commentedMay 3, 2018
| $tableRows[] =array(sprintf(' handled by %s',$handler)); | ||
| } | ||
| } | ||
| $io->table(array(),$tableRows); |
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.
Minor, but we should print some message here if there are NO messages, like:
No messages were found that have valid 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.
@ro0NL can you update this PR at some point? Will be for beta2 now but can still be in 4.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.
Done.
yceruto left a comment
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.
👍
| * | ||
| * @experimental in 4.1 | ||
| */ | ||
| class MessengerDebugCommandextends Command |
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.
Shouldn't it be namedDebugCommand like debug commands in other components?
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.
Good point@yceruto, you are right. Commands within components' namespace are not prefixed with the component name, let's keep it this 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.
Renamed 👍
ro0NL commentedMay 9, 2018
Thx@sroze .. still no clue about failing test :( |
ogizanagi commentedMay 9, 2018 • 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.
@ro0NL : |
ogizanagi commentedMay 9, 2018 • 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.
The |
ro0NL commentedMay 9, 2018
your're right. switched it to |
ogizanagi commentedMay 9, 2018
That's usually what is done, so unless I'm missing something it should work:e81005e. It should resolve as far as |
sroze commentedMay 9, 2018
Yay, and tests are all green now. Thanks@ogizanagi for the hint. |
sroze commentedMay 9, 2018
Thanks@ro0NL for working on this feature, this is much appreciated. |
…oze)This PR was merged into the 4.1 branch.Discussion----------[Messenger] Add debug:messenger CLI command| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features -->Adds a `debug:messenger` CLI command to expose message classes that can be dispatched. Heavily inspired by `debug:autowiring`.Commits-------7f87309 fix deps290c7eb Rename the command `DebugCommand`9847b83 [Messenger] Add debug:messenger CLI command


Adds a
debug:messengerCLI command to expose message classes that can be dispatched. Heavily inspired bydebug:autowiring.