File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -48,16 +48,23 @@ message handler. It's a class with an ``__invoke`` method::
48
48
49
49
// src/MessageHandler/MyMessageHandler.php
50
50
namespace App\MessageHandler;
51
+
52
+ use Symfony\Component\Messenger\Handler;
51
53
52
- class MyMessageHandler
54
+ class MyMessageHandler implements MessageHandlerInterface
53
55
{
54
56
public function __invoke(MyMessage $message)
55
57
{
56
58
// do something with it.
57
59
}
58
60
}
59
61
60
- Once you've created your handler, you need to register it:
62
+ Message handlers must be registered as services and :doc: `tagged </service_container/tags >`
63
+ with the ``messenger.message_handler `` tag. If you're using the
64
+ :ref: `default services.yaml configuration <service-container-services-load-example >`,
65
+ this is already done for you, thanks to :ref: `autoconfiguration <services-autoconfigure >`.
66
+
67
+ If you're not using autoconfigure functionality, then you need to register it:
61
68
62
69
.. configuration-block ::
63
70
You can’t perform that action at this time.
0 commit comments