From a526108b9583e6648991ce2dc0a214e62194d17f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jul 2019 15:10:09 -0400 Subject: [PATCH] pushing autoconfigure into code block --- messenger/multiple_buses.rst | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst index b21d30ef625..a3ed31225cf 100644 --- a/messenger/multiple_buses.rst +++ b/messenger/multiple_buses.rst @@ -120,6 +120,9 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha services: App\MessageHandler\SomeCommandHandler: tags: [{ name: messenger.message_handler, bus: messenger.bus.commands }] + # prevent handlers from being registered twice (or you can remove + # the MessageHandlerInterface that autoconfigure uses to find handlers) + autoconfigure: false .. code-block:: xml @@ -147,14 +150,6 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha This way, the ``App\MessageHandler\SomeCommandHandler`` handler will only be known by the ``messenger.bus.commands`` bus. -.. tip:: - - If you manually restrict handlers be sure to have ``autoconfigure`` disabled, - or not implement the ``Symfony\Component\Messenger\Handler\MessageHandlerInterface`` - as this might cause your handler to be registered twice. - - See :ref:`service autoconfiguration ` for more information. - You can also automatically add this tag to a number of classes by following a naming convention and registering all of the handler services by name with the correct tag: