Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8526c3

Browse files
committed
[#12231] Explicitly name the options that can be configured through tags
1 parent 87cb74d commit b8526c3

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

messenger.rst

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,6 @@ by tagging the handler service with ``messenger.message_handler``
10481048
# only needed if can't be guessed by type-hint
10491049
handles: App\Message\SmsNotification
10501050
1051-
# options returned by getHandledMessages() are supported here
1052-
10531051
.. code-block:: xml
10541052
10551053
<!-- config/services.xml -->
@@ -1061,7 +1059,9 @@ by tagging the handler service with ``messenger.message_handler``
10611059
10621060
<services>
10631061
<service id="App\MessageHandler\SmsNotificationHandler">
1064-
<tag name="messenger.message_handler"/>
1062+
<!-- handles is only needed if it can't be guessed by type-hint -->
1063+
<tag name="messenger.message_handler"
1064+
handles="App\Message\SmsNotification"/>
10651065
</service>
10661066
</services>
10671067
</container>
@@ -1070,9 +1070,26 @@ by tagging the handler service with ``messenger.message_handler``
10701070
10711071
// config/services.php
10721072
use App\MessageHandler\SmsNotificationHandler;
1073+
use App\Message\SmsNotification;
10731074
10741075
$container->register(SmsNotificationHandler::class)
1075-
->addTag('messenger.message_handler');
1076+
->addTag('messenger.message_handler', [
1077+
// only needed if can't be guessed by type-hint
1078+
'handles' => SmsNotification::class,
1079+
]);
1080+
1081+
1082+
Possible options to configure with tags are:
1083+
1084+
* ``bus``
1085+
* ``from_transport``
1086+
* ``handles``
1087+
* ``method``
1088+
* ``priority``
1089+
1090+
.. versionadded:: 4.4
1091+
1092+
The ability to specify ``from_transport`` on the tag, was added in Symfony 4.4.
10761093

10771094
Handler Subscriber & Options
10781095
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1229,15 +1246,6 @@ Then, make sure to "route" your message to *both* transports:
12291246
12301247
That's it! You can now consume each transport:
12311248

1232-
.. note::
1233-
1234-
It is possible to specify ``from_transport`` as attribute on the ``messenger.message_handler`` tag.
1235-
1236-
.. versionadded:: 4.4
1237-
1238-
The ability to specify ``from_transport`` on the ``messenger.message_handler`` tag
1239-
itself, was added in Symfony 4.4.
1240-
12411249
.. code-block:: terminal
12421250
12431251
# will only call ThumbnailUploadedImageHandler when handling the message

0 commit comments

Comments
 (0)