middleware change

This commit is contained in:
Dominik Garbulski 2021-05-06 08:17:03 +02:00
parent fb0c807c67
commit 6ed6307669
2 changed files with 11 additions and 20 deletions

View file

@ -5,20 +5,7 @@
## Context and Problem Statement
We had 7 different names of buses across all sylius products, we decided to unify them.
Sylius and any other following product (like plugins) should utilize `sylius.command_bus` for command dispatching and `sylius.event_bus` for events.
## Considered Options
### Leaving different buses as it was till now
* Good, because it doesnt require much work
* Bad, because we need to keep track of all available buses
### Unifying buses across all products
* Good, because we will have only few buses to keep track of
* Bad, because potential bc break
## Decision Outcome
Chosen option: Unifying buses across all products, it allows us stick to one bus naming style
Take into account, that the command bus requires to have one corresponding handler for each message dispatched in contradiction to the event bus(where there is no such requirement).
In addition, the command bus will perform command validation and wrap the following handler within a transaction and flush to the database.

View file

@ -34,19 +34,23 @@ framework:
messenger:
buses:
sylius.command_bus: &command_bus
default_middleware: allow_no_handlers
middleware:
- 'validation'
- 'doctrine_transaction'
sylius.event_bus: &event_bus
default_middleware: allow_no_handlers
middleware:
- 'validation'
- 'doctrine_transaction'
sylius_default.bus: *command_bus
sylius_event.bus: *event_bus
services:
sylius_default.bus:
deprecated: 'The "%service_id%" service alias is deprecated.'
synthetic: true
abstract: true
sylius_event.bus:
deprecated: 'The "%service_id%" service alias is deprecated.'
synthetic: true
abstract: true
lexik_jwt_authentication:
token_extractors: