File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 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::
4848
4949 // src/MessageHandler/MyMessageHandler.php
5050 namespace App\MessageHandler;
51+
52+ use Symfony\Component\Messenger\Handler;
5153
52- class MyMessageHandler
54+ class MyMessageHandler implements MessageHandlerInterface
5355 {
5456 public function __invoke(MyMessage $message)
5557 {
5658 // do something with it.
5759 }
5860 }
5961
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:
6168
6269.. configuration-block ::
6370
You can’t perform that action at this time.
0 commit comments