Skip to content

Commit 41f4013

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Messenger] Add doc for default routing for messages
2 parents 967e7a4 + 5781a94 commit 41f4013

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

messenger.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,18 @@ you can configure them to be sent to a transport:
256256
257257
Thanks to this, the ``App\Message\SmsNotification`` will be sent to the ``async``
258258
transport and its handler(s) will *not* be called immediately. Any messages not
259-
matched under ``routing`` will still be handled immediately.
259+
matched under ``routing`` will still be handled immediately, i.e. synchronously.
260+
261+
.. note::
262+
263+
You may use ``'*'`` as the message class. This will act as a default routing
264+
rule for any message not matched under ``routing``. This is useful to ensure
265+
no message is handled synchronously by default.
266+
267+
The only drawback is that ``'*'`` will also apply to the emails sent with the
268+
Symfony Mailer (which uses ``SendEmailMessage`` when Messenger is available).
269+
This could cause issues if your emails are not serializable (e.g. if they include
270+
file attachments as PHP resources/streams).
260271

261272
You can also route classes by their parent class or interface. Or send messages
262273
to multiple transports:

0 commit comments

Comments
 (0)