Skip to content

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

Merged
merged 1 commit into from
May 22, 2018

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented May 14, 2018

No description provided.

@xabbuh xabbuh added this to the 4.1 milestone May 14, 2018
Copy link
Contributor

@ogizanagi ogizanagi left a 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">
Copy link
Contributor

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?

@xabbuh
Copy link
Member Author

xabbuh commented May 15, 2018

@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="" />
Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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

@xabbuh xabbuh force-pushed the messenger-tweaks branch from 0068b23 to 8944edd Compare May 15, 2018 07:04
@javiereguiluz
Copy link
Member

We've just deployed a change to add Messenger to the list of guides: https://symfony.com/doc/current/index.html

@ogizanagi
Copy link
Contributor

@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>
Copy link
Contributor

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'));
Copy link
Contributor

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="" />
Copy link
Contributor

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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
Copy link
Contributor

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" />
Copy link
Contributor

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 xabbuh force-pushed the messenger-tweaks branch from a8d02a4 to fc90426 Compare May 18, 2018 09:05
@javiereguiluz
Copy link
Member

@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="" />
Copy link
Member Author

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

@javiereguiluz
Copy link
Member

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.

@javiereguiluz javiereguiluz merged commit fc90426 into symfony:master May 22, 2018
javiereguiluz added a commit that referenced this pull request May 22, 2018
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
@xabbuh xabbuh deleted the messenger-tweaks branch May 22, 2018 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants