When I execute bin/console debug:messenger
I get:
Messenger
=========
async.command.bus
-----------------
The following messages can be dispatched:
--------------------------------------------------------------------------------
App\Application\Command\SendEmailNotifications
handled by App\Infrastructure\Handler\SendEmailNotificationsHandler
App\Application\Command\DummyMessage
handled by App\Infrastructure\Handler\Dummy\DummyMessageHandler
App\Application\Command\BoostLead\InsertLead
handled by App\Infrastructure\Handler\InsertLeadHandler
--------------------------------------------------------------------------------
Clearly showing that there is handler registered for App\Application\Command\DummyMessage
.
But after I dispatch the a message and I try to consume it with messenger:consume
I get:
No handler for message "App\Application\Command\DummyMessage
full error message, emphasis mine:
16:38:12 ERROR [messenger] Error thrown while handling message App\Application\Command\DummyMessage. Sending for retry #1 using 1000 ms delay. Error: "No handler for message "App\Application\Command\DummyMessage"." ["message" => App\Application\Command\DummyMessage^ { …},"class" =>"App\Application\Command\DummyMessage","retryCount" => 1,"delay" => 1000,"error" =>"No handler for message "App\Application\Command\DummyMessage".","exception" => Symfony\Component\Messenger\Exception\NoHandlerForMessageException^ { …}]
If I execute debug:container DummyMessageHandler
I get:
Information for Service "App\Infrastructure\Handler\Dummy\DummyMessageHandler"
==============================================================================
---------------- ------------------------------------------------------
Option Value
---------------- ------------------------------------------------------
Service ID App\Infrastructure\Handler\Dummy\DummyMessageHandler
Class App\Infrastructure\Handler\Dummy\DummyMessageHandler
Tags messenger.message_handler (bus: async.command.bus)
Public no
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired yes
Autoconfigured yes
---------------- ------------------------------------------------------
The handler it's fairly simple, with only a __invoke(DummyMessage $message)
method.
How can it be the handler is found when executing the debugger, but not when actually consuming the messages? Where can I look what's going on?