Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[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 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.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| .. index:: | ||
| single: Messenger; Multiple buses | ||
| Multiple Buses | ||
| ============== | ||
| A common architecture when building application is to separate commands from | ||
| queries. Commands are actions that do something and queries fetches data. This | ||
| is called CQRS (Command Query Responsibility Segregation). See Martin Fowler's | ||
| `article about CQRS`_ to learn more. This architecture could be used together | ||
| with the messenger component by defining multiple buses. | ||
| A **command bus** is a little different form a **query bus**. As example, | ||
| command buses must not return anything and query buses are rarely asynchronous. | ||
| 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. | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
| .. configuration-block:: | ||
| .. code-block:: yaml | ||
| framework: | ||
| messenger: | ||
| default_bus: messenger.bus.command | ||
| buses: | ||
| messenger.bus.command: | ||
| middleware: | ||
| - messenger.middleware.validation | ||
| - messenger.middleware.handles_recorded_messages: ['@messenger.bus.event'] | ||
| - doctrine_transaction_middleware: ['default'] | ||
| messenger.bus.query: | ||
| middleware: | ||
| - messenger.middleware.validation | ||
| messenger.bus.event: | ||
| middleware: | ||
| - messenger.middleware.allow_no_handler | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. In 4.2, (https://github.com/symfony/symfony/blob/master/UPGRADE-4.2.md#frameworkbundle) | ||
| - messenger.middleware.validation | ||
| .. _article about CQRS: https://martinfowler.com/bliki/CQRS.html | ||