@@ -24,16 +24,16 @@ an **event bus**. The event bus could have zero or more subscribers.
2424 framework :
2525 messenger :
2626 # The bus that is going to be injected when injecting MessageBusInterface
27- default_bus : messenger .bus.commands
27+ default_bus : command .bus
2828 buses :
29- messenger .bus.commands :
29+ command .bus :
3030 middleware :
3131 - validation
3232 - doctrine_transaction
33- messenger .bus.queries :
33+ query .bus :
3434 middleware :
3535 - validation
36- messenger .bus.events :
36+ event .bus :
3737 default_middleware : allow_no_handlers
3838 middleware :
3939 - validation
@@ -52,15 +52,15 @@ an **event bus**. The event bus could have zero or more subscribers.
5252
5353 <framework : config >
5454 <!-- The bus that is going to be injected when injecting MessageBusInterface -->
55- <framework : messenger default-bus =" messenger .bus.commands " >
56- <framework : bus name =" messenger .bus.commands " >
55+ <framework : messenger default-bus =" command .bus" >
56+ <framework : bus name =" command .bus" >
5757 <framework : middleware id =" validation" />
5858 <framework : middleware id =" doctrine_transaction" />
5959 <framework : bus >
60- <framework : bus name =" messenger .bus.queries " >
60+ <framework : bus name =" query .bus" >
6161 <framework : middleware id =" validation" />
6262 <framework : bus >
63- <framework : bus name =" messenger .bus.events " default-middleware =" allow_no_handlers" >
63+ <framework : bus name =" event .bus" default-middleware =" allow_no_handlers" >
6464 <framework : middleware id =" validation" />
6565 <framework : bus >
6666 </framework : messenger >
@@ -73,20 +73,20 @@ an **event bus**. The event bus could have zero or more subscribers.
7373 $container->loadFromExtension('framework', [
7474 'messenger' => [
7575 // The bus that is going to be injected when injecting MessageBusInterface
76- 'default_bus' => 'messenger .bus.commands ',
76+ 'default_bus' => 'command .bus',
7777 'buses' => [
78- 'messenger .bus.commands ' => [
78+ 'command .bus' => [
7979 'middleware' => [
8080 'validation',
8181 'doctrine_transaction',
8282 ],
8383 ],
84- 'messenger .bus.queries ' => [
84+ 'query .bus' => [
8585 'middleware' => [
8686 'validation',
8787 ],
8888 ],
89- 'messenger .bus.events ' => [
89+ 'event .bus' => [
9090 'default_middleware' => 'allow_no_handlers',
9191 'middleware' => [
9292 'validation',
@@ -98,62 +98,12 @@ an **event bus**. The event bus could have zero or more subscribers.
9898
9999 This will create three new services:
100100
101- * ``messenger .bus.commands ``: autowireable with the :class: `Symfony\\ Component\\ Messenger\\ MessageBusInterface `
101+ * ``command .bus ``: autowireable with the :class: `Symfony\\ Component\\ Messenger\\ MessageBusInterface `
102102 type-hint (because this is the ``default_bus ``);
103103
104- * ``messenger .bus.queries ``: autowireable with the ``MessageBusInterface $messengerBusQueries ``;
104+ * ``query .bus ``: autowireable with ``MessageBusInterface $queryBus ``;
105105
106- * ``messenger.bus.events ``: autowireable with the ``MessageBusInterface $messengerBusEvents ``.
107-
108- Type-hints and Auto-wiring
109- --------------------------
110-
111- Auto-wiring is a great feature that allows you to reduce the amount of configuration
112- required for your service container to be created. By using ``MessageBusInterface ``
113- as argument type-hint in your services, the default configured bus will be injected
114- (i.e ``messenger.bus.commands `` in above examples).
115-
116- When working with multiple buses, you can use the ``DependencyInjection `` component's
117- binding capabilities to clarify which bus will be injected based on the argument's name:
118-
119- .. configuration-block ::
120-
121- .. code-block :: yaml
122-
123- # config/services.yaml
124- services :
125- _defaults :
126- # ...
127-
128- bind :
129- $commandBus : ' @messenger.bus.commands'
130- $queryBus : ' @messenger.bus.queries'
131- $eventBus : ' @messenger.bus.events'
132-
133- .. code-block :: xml
134-
135- <!-- config/services.xml -->
136- <?xml version =" 1.0" encoding =" UTF-8" ?>
137- <container xmlns =" http://symfony.com/schema/dic/services"
138- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
139- xsi : schemaLocation =" http://symfony.com/schema/dic/services
140- https://symfony.com/schema/dic/services/services-1.0.xsd" >
141-
142- <services >
143- <defaults >
144- <bind key =" $commandBus" type =" service" id =" messenger.bus.commands" />
145- <bind key =" $queryBus" type =" service" id =" messenger.bus.queries" />
146- <bind key =" $eventBus" type =" service" id =" messenger.bus.events" />
147- </defaults >
148- </services >
149- </container >
150-
151- .. code-block :: php
152-
153- // config/services.php
154- $container->bind('$commandBus', 'messenger.bus.commands');
155- $container->bind('$queryBus', 'messenger.bus.queries');
156- $container->bind('$eventBus', 'messenger.bus.events');
106+ * ``event.bus ``: autowireable with ``MessageBusInterface $eventBus ``.
157107
158108Restrict Handlers per Bus
159109-------------------------
0 commit comments