Skip to content

Commit 6c99120

Browse files
committed
[Messenger] Routing & Inheritance
1 parent 707580e commit 6c99120

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

messenger.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,35 @@ transport and "sending" messages there to be handled immediately:
431431
],
432432
]);
433433
434+
Message Inheritance & Routing Configuration
435+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436+
437+
With the following code and configuration, messages will be dispatched like this:
438+
* `Notification` to `async_1`
439+
* `SmsNotification` to `async_1`
440+
* `SmsNotification` to `async_2`
441+
442+
.. code-block::php
443+
444+
<?php
445+
namespace App\Message;
446+
class SmsNotification extends Notification {}
447+
448+
.. code-block::yaml
449+
450+
# config/packages/messenger.yaml
451+
framework:
452+
messenger:
453+
routing:
454+
App\Message\Notification: async_1
455+
App\Message\SmsNotification: async_2
456+
457+
.. code-block::php
458+
459+
<?php
460+
$messageBus->dispatch(new Notification());
461+
$messageBus->dispatch(new SmsNotification());
462+
434463
Creating your Own Transport
435464
~~~~~~~~~~~~~~~~~~~~~~~~~~~
436465

0 commit comments

Comments
 (0)