8000 minor #11977 pushing autoconfigure note into code block (weaverryan) · symfony/symfony-docs@6a59686 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a59686

Browse files
committed
minor #11977 pushing autoconfigure note into code block (weaverryan)
This PR was merged into the 4.3 branch. Discussion ---------- pushing autoconfigure note into code block The next example below already does this. Most people WILL need `autoconfigure: false`, so let's include it in the actual code. Commits ------- a526108 pushing autoconfigure into code block
2 parents 701c6ad + a526108 commit 6a59686

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

messenger/multiple_buses.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha
120120
services:
121121
App\MessageHandler\SomeCommandHandler:
122122
tags: [{ name: messenger.message_handler, bus: messenger.bus.commands }]
123+
# prevent handlers from being registered twice (or you can remove
124+
# the MessageHandlerInterface that autoconfigure uses to find handlers)
125+
autoconfigure: false
123126
124127
.. code-block:: xml
125128
@@ -147,14 +150,6 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha
147150
This way, the ``App\MessageHandler\SomeCommandHandler`` handler will only be
148151
known by the ``messenger.bus.commands`` bus.
149152

150-
.. tip::
151-
152-
If you manually restrict handlers be sure to have ``autoconfigure`` disabled,
153-
or not implement the ``Symfony\Component\Messenger\Handler\MessageHandlerInterface``
154-
as this might cause your handler to be registered twice.
155-
156-
See :ref:`service autoconfiguration <services-autoconfigure>` for more information.
157-
158153
You can also automatically add this tag to a number of classes by following
159154
a naming convention and registering all of the handler services by name with
160155
the correct tag:

0 commit comments

Comments
 (0)
0