Skip to content

Commit 8f71b8b

Browse files
committedAug 26, 2021
[Messenger] Add example of handler autoconfiguration with attributes
1 parent 8f83b9e commit 8f71b8b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎messenger/multiple_buses.rst

+12
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ you can determine the message bus based on an implemented interface:
154154

155155
.. configuration-block::
156156

157+
.. code-block:: php-attributes
158+
159+
// src/MessageHandler/CommandHandlerInterface.php
160+
namespace App\MessageHandler;
161+
162+
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
163+
164+
#[Autoconfigure(tags: [['name' => 'messenger.message_handler', 'bus' => 'command.bus']])]
165+
interface CommandHandlerInterface
166+
{
167+
}
168+
157169
.. code-block:: yaml
158170
159171
# config/services.yaml

0 commit comments

Comments
 (0)