Skip to content

[Messenger][WIP] Show how to configure multiple buses #10016

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

Closed
wants to merge 2 commits into from

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jul 4, 2018

We do currently have no example configuration with the framework bundle. I think it is a good idea to show of how to use middleware's and how to define multiple buses.

This PR could be rewritten as a part of an existing page.

I know the configuration is not very different between the buses. When symfony/symfony#27839 and symfony/symfony#27840 is implemented, this config will make more sense.

@ogizanagi
Copy link
Contributor

ogizanagi commented Jul 6, 2018

I don't know if this is a hard rule for Symfony docs, but the framework integration usually is documented in the Guides section or a dedicated page, not in the Component documentation itself.
Therefore, you can already find a doc entry accessible from the "Guides" menu showing config samples & multiple buses wiring: https://symfony.com/doc/current/messenger.html#multiple-buses.
In any case, this PR would be a nice addition to the existing section. 👍

@Koc
Copy link
Contributor

Koc commented Oct 5, 2018

Please describe how to register command/event/query handlers and how to seggregate them between buses. Nobody wants handle received message from from event bus through middlewares for command bus.

@ogizanagi
Copy link
Contributor

@Koc's comment relates to #10477. Indeed this PR might be a good place for documenting it too, but not mandatory.

Appart from the mention of a returned value in a query bus, which is not possible anymore, I think this PR is ready.

- messenger.middleware.validation
messenger.bus.event:
middleware:
- messenger.middleware.allow_no_handler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 4.2, default_middleware: allow_no_handlers must be used instead.

(https://github.com/symfony/symfony/blob/master/UPGRADE-4.2.md#frameworkbundle)

@ogizanagi
Copy link
Contributor

I've continued your work in #10689 , adding some more things (including @Koc 's comment).

You can configure these buses and their rules by using middlewares.

It might also be a good idea to separate actions from reactions by introducing
an **event bus**. The event bus could have zero or more subscribers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're mentioning that events have zero or more subscribers, we should probably mention that commands and queries have exactly one handler.

@Nyholm
Copy link
Member Author

Nyholm commented Dec 27, 2018

Thank you @magnusnordlander and @ogizanagi

@Nyholm Nyholm deleted the multiple-buses branch December 27, 2018 21:38
@hoebelix
Copy link

hoebelix commented Feb 6, 2019

In https://symfony.com/doc/master/messenger/multiple_buses.html there is no example for a routing configuration for multiple buses. It would be nice if there was a typical example configuration, something like:
Route all messages of messenger.bus.events to a amqp transport, handle all messages of messenger.bus.commands synchronously.

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