Skip to content

Commit d71b5bc

Browse files
committed
minor #16720 [Messenger] Add doc for default routing for messages (clemherreman)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Messenger] Add doc for default routing for messages Hello, I recently got bit on production after deploying a code change. We created a new `FooMessage` & `FooHandler`, but didn't update the `messenger.yaml` to include routing information. This caused `FooMessage` to be directly handled by the HTTP process that dispatched the message, instead of the CLI, consumer process of Messenger. This lead to various issues: missing env var in HTTP context, lack of monitoring/stats as we only looks for messages metrics in the `consumer` container, not the `api` one :) Looking at the code, I discovered you may define a default transport, but couldn't find it in the doc. Commits ------- 955b393 [Messenger] Add doc for default routing for messages
2 parents 62a65a6 + 955b393 commit d71b5bc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

messenger.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,13 @@ you can configure them to be sent to a transport:
261261
262262
Thanks to this, the ``App\Message\SmsNotification`` will be sent to the ``async``
263263
transport and its handler(s) will *not* be called immediately. Any messages not
264-
matched under ``routing`` will still be handled immediately.
264+
matched under ``routing`` will still be handled immediately, i.e. synchronously.
265+
266+
.. note::
267+
268+
You may use ``'*'`` as the message class. This will act as a default routing
269+
rule for any message not matched under ``routing``. This is useful to ensure
270+
no message is handled synchronously by default.
265271

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

0 commit comments

Comments
 (0)