@@ -22,7 +22,7 @@ install messenger before using it:
2222 Using the Messenger Service
2323---------------------------
2424
25- Once enabled, the :code: ` message_bus ` service can be injected in any service where
25+ Once enabled, the `` message_bus ` ` service can be injected in any service where
2626you need it, like in a controller::
2727
2828 // src/Controller/DefaultController.php
@@ -33,9 +33,9 @@ you need it, like in a controller::
3333
3434 class DefaultController extends Controller
3535 {
36- public function indexAction (MessageBusInterface $bus)
36+ public function index (MessageBusInterface $bus)
3737 {
38- $bus->dispatch(new MyMessage( ));
38+ $bus->dispatch(new SendNotification('A string to be sent...' ));
3939 }
4040 }
4141
@@ -97,21 +97,21 @@ the messenger component, the following configuration should have been created:
9797
9898 # .env
9999 # ##> symfony/messenger ###
100- AMQP_DSN =amqp://guest:guest@localhost:5672/%2f/messages
100+ MESSENGER_DSN =amqp://guest:guest@localhost:5672/%2f/messages
101101 # ##< symfony/messenger ###
102102
103- This is enough to allow you to route your message to the :code: ` messenger.default_adapter `
103+ This is enough to allow you to route your message to the `` messenger.default_adapter ` `
104104adapter. This will also configure the following for you:
105105
106- 1. A :code: ` messenger.default_sender ` sender to be used when routing messages
107- 2. A :code: ` messenger.default_receiver ` receiver to be used when consuming messages.
106+ 1. A `` messenger.default_sender ` ` sender to be used when routing messages
107+ 2. A `` messenger.default_receiver ` ` receiver to be used when consuming messages.
108108
109109Routing
110110-------
111111
112112Instead of calling a handler, you have the option to route your message(s) to a
113113sender. Part of an adapter, it is responsible of sending your message somewhere.
114- You can configuration which message is routed to which sender with the following
114+ You can configure which message is routed to which sender with the following
115115configuration:
116116
117117.. code-block :: yaml
@@ -121,9 +121,8 @@ configuration:
121121 routing :
122122 ' My\Message\Message ' : messenger.default_sender # Or another sender service name
123123
124- Such configuration would only route the ``MessageAboutDoingOperationalWork ``
125- message to be asynchronous, the rest of the messages would still be directly
126- handled.
124+ Such configuration would only route the ``My\Message\Message `` message to be
125+ asynchronous, the rest of the messages would still be directly handled.
127126
128127If you want to do route all the messages to a queue by default, you can use such
129128configuration:
@@ -146,7 +145,7 @@ Note that you can also route a message to multiple senders at the same time:
146145 ' My\Message\ToBeSentToTwoSenders ' : [messenger.default_sender, messenger.audit_sender]
147146
148147 Last but not least you can also route a message while still calling the handler
149- on your application by having a :code: ` null ` sender:
148+ on your application by having a `` null ` ` sender:
150149
151150.. code-block :: yaml
152151
@@ -159,23 +158,23 @@ Consuming messages
159158------------------
160159
161160Once your messages have been routed, you will like to consume your messages in most
162- of the cases. Do to so, you can use the :code: ` messenger:consume-messages ` command
161+ of the cases. Do to so, you can use the `` messenger:consume-messages ` ` command
163162like this:
164163
165164.. code-block :: terminal
166165
167166 $ bin/console messenger:consume-messages messenger.default_receiver
168167
169168 The first argument is the receiver's service name. It might have been created by
170- your :code: ` adapters ` configuration or it can be your own receiver.
169+ your `` adapters ` ` configuration or it can be your own receiver.
171170
172- Registering your middlewares
173- ----------------------------
171+ Registering your middleware
172+ ---------------------------
174173
175- The message bus is based on middlewares . If you are un-familiar with the concept,
174+ The message bus is based on a set of middleware . If you are un-familiar with the concept,
176175look at the :doc: `Messenger component docs </components/messenger >`.
177176
178- To register your middleware, use the :code: ` messenger.middleware ` tag as in the
177+ To register your middleware, use the `` messenger.middleware ` ` tag as in the
179178following example:
180179
181180.. code-block :: xml
@@ -213,7 +212,7 @@ DSN. You will need an adapter factory::
213212 }
214213 }
215214
216- The :code: ` YourAdaper ` class need to implements the :code: ` AdapterInterface `. It
215+ The `` YourAdaper `` class need to implement the `` AdapterInterface ` `. It
217216will like the following example::
218217
219218 use Symfony\Component\Messenger\Adapter\Factory\AdapterInterface;
@@ -245,7 +244,7 @@ Register your factory
245244 Use your adapter
246245~~~~~~~~~~~~~~~~
247246
248- Within the :code: ` framework.messenger.adapters.* ` configuration, create your
247+ Within the `` framework.messenger.adapters.* ` ` configuration, create your
249248named adapter using your own DSN:
250249
251250.. code-block :: yaml
@@ -257,8 +256,8 @@ named adapter using your own DSN:
257256
258257 This will give you access to the following services:
259258
260- 1. :code: ` messenger.yours_adapter `: the instance of your adapter.
261- 2. :code: ` messenger.yours_receiver ` and :code: ` messenger.yours_sender `, the
259+ 1. `` messenger.yours_adapter ` `: the instance of your adapter.
260+ 2. `` messenger.yours_receiver `` and `` messenger.yours_sender ` `, the
262261 receiver and sender created by the adapter.
263262
264263.. _`enqueue's adapter` : https://github.com/sroze/enqueue-bridge
0 commit comments