-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
some tweaks for the Messenger component docs #9771
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
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.
From where is referenced the messenger.rst
page? It seems it doesn't appear on the Guide list on the left, and the Messenger component page doesn't seem to reference it either.
messenger.rst
Outdated
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> | ||
|
||
<framework:config> | ||
<framework:messenger default-bus="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.
- <framework:messenger default-bus="commands">
+ <framework:messenger default-bus="messenger.bus.commands">
(same in other formats)
Perhaps we could recommend using something more simple like command_bus
, query_bus
and event_bus
rather than long prefixed ids?
@ogizanagi You are right, we still have to add them manually. |
messenger.rst
Outdated
<framework:messenger> | ||
<framework:routing message-class="My\Message\ThatIsGoingToBeSentAndHandledLocally"> | ||
<framework:sender service="audit" /> | ||
<framework:sender service="" /> |
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.
@sroze Can you have a look here? From looking at the code I would assume that <framework:sender />
would be expected here. But that seems to be forbidden by the schema definition.
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 would we allow a null
sender? Which part of the code are you referring about?
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.
Oh, NVM! I forgot about this. It allows sending while still triggering handlers.
Note that will change a bit after symfony/symfony#27002
We've just deployed a change to add |
@javiereguiluz : Great, thank you! I think we should reference it as well in the component documentation (in the "Learn more" section like for the Serializer component or instance). It's not easily discoverable otherwise. |
messenger.rst
Outdated
<framework:config> | ||
<framework:messenger default-bus="commands"> | ||
<framework:bus name="messenger.bus.default"> | ||
<framework:middleware>App\Middleware\MyMiddleware</framework:middleware> |
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.
Note: the xml format for middleware changed (for factories):
- <framework:middleware>App\Middleware\MyMiddleware</framework:middleware>
+ <framework:middleware id="App\Middleware\MyMiddleware" />
messenger.rst
Outdated
use App\MessageHandler\MyMessageHandler; | ||
|
||
$container->register(MyMessageHandler::class) | ||
->setTags(array('messenger.message_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.
Minor but could we use addTag
instead to simplify?
+ $container->register(MyMessageHandler::class)
- ->setTags(array('messenger.message_handler'));
+ ->addTag('messenger.message_handler');
messenger.rst
Outdated
<framework:messenger> | ||
<framework:routing message-class="My\Message\ThatIsGoingToBeSentAndHandledLocally"> | ||
<framework:sender service="audit" /> | ||
<framework:sender service="" /> |
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.
Oh, NVM! I forgot about this. It allows sending while still triggering handlers.
Note that will change a bit after symfony/symfony#27002
components/messenger.rst
Outdated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
To allow us to receive and send messages on the same bus and prevent an infinite | ||
To allow to receive and send messages on the same bus and prevent an infinite |
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.
What about: To allow sending and receiving messages on the same bus...
?
messenger.rst
Outdated
<framework:config> | ||
<framework:messenger> | ||
<framework:routing message-class="My\Message\ThatIsGoingToBeSentAndHandledLocally"> | ||
<framework:sender service="audit" /> |
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.
amqp
instead of audit
to have the same example as in YAML and PHP
@xabbuh do you consider this PR ready and finished? Thanks! |
<framework:messenger> | ||
<framework:routing message-class="My\Message\ThatIsGoingToBeSentAndHandledLocally"> | ||
<framework:sender service="amqp" /> | ||
<framework:sender service="" /> |
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.
@javiereguiluz this one doesn't look right to me, but I fear we need to fix the code first to make the example possible
Thanks Christian! I've merged this because it's too important to keep it waiting. I've opened symfony/symfony#27335 to not forget about the issue you mentioned. |
This PR was merged into the master branch. Discussion ---------- some tweaks for the Messenger component docs <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- fc90426 some tweaks for the Messenger component docs
No description provided.