Ask Your Question
0

When I utilize AsMessageHandler attribute, why does the Symfony debug:messenger command display my messenger handler twice?

asked 2023-07-05 12:08:49 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-05 12:30:02 +0000

ladyg gravatar image

This is because when you use the AsMessageHandler attribute, Symfony creates a separate service for the handler, and this service has its own name. Therefore, when you run the debug:messenger command, you will see both the original service and the new service created by Symfony.

For example, if you have a service named "MyHandlerService" and you add the AsMessageHandler attribute to it, Symfony will create a new service named "messenger.handler.MyHandlerService". When you run the debug:messenger command, you will see both "MyHandlerService" and "messenger.handler.MyHandlerService".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-05 12:08:49 +0000

Seen: 13 times

Last updated: Jul 05 '23