@@ -1048,8 +1048,6 @@ by tagging the handler service with ``messenger.message_handler``
1048
1048
# only needed if can't be guessed by type-hint
1049
1049
handles : App\Message\SmsNotification
1050
1050
1051
- # options returned by getHandledMessages() are supported here
1052
-
1053
1051
.. code-block :: xml
1054
1052
1055
1053
<!-- config/services.xml -->
@@ -1061,7 +1059,9 @@ by tagging the handler service with ``messenger.message_handler``
1061
1059
1062
1060
<services >
1063
1061
<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" />
1065
1065
</service >
1066
1066
</services >
1067
1067
</container >
@@ -1070,9 +1070,26 @@ by tagging the handler service with ``messenger.message_handler``
1070
1070
1071
1071
// config/services.php
1072
1072
use App\MessageHandler\SmsNotificationHandler;
1073
+ use App\Message\SmsNotification;
1073
1074
1074
1075
$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.
1076
1093
1077
1094
Handler Subscriber & Options
1078
1095
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1229,15 +1246,6 @@ Then, make sure to "route" your message to *both* transports:
1229
1246
1230
1247
That's it! You can now consume each transport:
1231
1248
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
-
1241
1249
.. code-block :: terminal
1242
1250
1243
1251
# will only call ThumbnailUploadedImageHandler when handling the message
0 commit comments