Skip to content

Commit e45d89e

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: [Messenger] Add doc for default routing for messages
2 parents 6c90946 + 41f4013 commit e45d89e

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
@@ -266,7 +266,18 @@ you can configure them to be sent to a transport:
266266
267267
Thanks to this, the ``App\Message\SmsNotification`` will be sent to the ``async``
268268
transport and its handler(s) will *not* be called immediately. Any messages not
269-
matched under ``routing`` will still be handled immediately.
269+
matched under ``routing`` will still be handled immediately, i.e. synchronously.
270+
271+
.. note::
272+
273+
You may use ``'*'`` as the message class. This will act as a default routing
274+
rule for any message not matched under ``routing``. This is useful to ensure
275+
no message is handled synchronously by default.
276+
277+
The only drawback is that ``'*'`` will also apply to the emails sent with the
278+
Symfony Mailer (which uses ``SendEmailMessage`` when Messenger is available).
279+
This could cause issues if your emails are not serializable (e.g. if they include
280+
file attachments as PHP resources/streams).
270281

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

0 commit comments

Comments
 (0)