Symfony version: 4.3.2
PHP: 7.2.20
I am trying to use the messenger component with the doctrine transport asynchronously. I have installed the messenger via composer require messenger
with the help of Symfony Flex.
I have activated the doctrine transport by MESSENGER_TRANSPORT_DSN=doctrine://default
in the .env.local
.
In the messenger config the transport is configured as well:
framework:
messenger:
transports:
async: '%env(MESSENGER_TRANSPORT_DSN)%'
routing:
'App\Message\SomeNotification': async
When dispatching the message in the controller with $this->dispatchMessage(new SomeNotification('some content'));
everything is fine. The table messenger_messages
of the doctrine transport gets created automatically and the message is saved in the table correctly.
When trying to consume the message with ./bin/console messenger:consume async
I'm getting the following error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Argument 2 passed to Symfony\Component\Messenger\Worker::__construct() must implement interface Symfony\Component\Messenger\MessageBusInterface, string given, called in ..../vendor/symfony/messenger/
Command/ConsumeMessagesCommand.php on line 190
So the $routableBus in the Symfony\Component\Messenger\Command\ConsumeMessagesCommand
is empty which leads to the crash when instantiating the Worker.