Skip to content

Commit d4f08a1

Browse files
committed
[Messenger] Add example of handler autoconfiguration with attributes
1 parent 8f83b9e commit d4f08a1

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
@@ -223,6 +223,18 @@ you can determine the message bus based on an implemented interface:
223223
->tag('messenger.message_handler', ['bus' => 'query.bus']);
224224
};
225225
226+
.. code-block:: php-attributes
227+
228+
// src/MessageHandler/CommandHandlerInterface.php
229+
namespace App\MessageHandler;
230+
231+
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
232+
233+
#[Autoconfigure(tags: [['name' => 'messenger.message_handler', 'bus' => 'command.bus']])]
234+
interface CommandHandlerInterface
235+
{
236+
}
237+
226238
Debugging the Buses
227239
-------------------
228240

0 commit comments

Comments
 (0)