Doctrine Migration Bundle runs its own checks for the Messenger component?
DavidGarciaCat opened this issue · 3 comments
When I warm up the Symfony cache, I don't get any error:
bin/console cache:clear -vvv
// Clearing the cache for the dev environment with debug true
// Warming up cache...
// Removing old build and cache directory...
// Finished
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
However, when I run the command to make a new migration including the diff changes on my ORM, I get the following error:
bin/console make:migration
In Connection.php line 106:
Unknown option found: [exchange]. Allowed options are [table_name, queue_name, redeliver_timeout, auto_setup, use_notify, check_delayed_interval, get_notify_timeout].
My messenger.yaml
file has the exchange
option, as I needed to add it to solve an issue with the AMQP's RabbitMQ integration:
framework:
messenger:
failure_transport: failed
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_AMQP)%'
options:
exchange:
name: async
type: direct
retry_strategy:
max_retries: 0
failed:
dsn: '%env(MESSENGER_TRANSPORT_DOCTRINE)%'
options:
queue_name: failed
routing:
# ...
I don't understand why the Doctrine Migrations Bundle decides to check my Messenger configuration and decide that the settings I have are invalid, while the Messenger component itself does not return any error when warming up the cache or when running the queued messages.
Please advice on how it can be resolved on my end unless it's an issue with the code in this bundle that requires a new PR (if this is the case, would be nice to know when it can be expected, as it's causing a blocker at the moment).
Thank you,
Getting a stack trace might help understanding what's happening.
Here's a trace of the command (running it inside the Docker container):
[root@86f7c8606725 project]# bin/console doctrine:migrations:diff -vvv
In Connection.php line 106:
[Symfony\Component\Messenger\Exception\InvalidArgumentException]
Unknown option found: [exchange]. Allowed options are [table_name, queue_name, redeliver_timeout, auto_setup, use_notify, check_delayed_interval, get_notify_timeout].
Exception trace:
at /opt/project/vendor/symfony/doctrine-messenger/Transport/Connection.php:106
Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection::buildConfiguration() at /opt/project/vendor/symfony/doctrine-messenger/Transport/DoctrineTransportFactory.php:43
Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransportFactory->createTransport() at /opt/project/vendor/symfony/messenger/Transport/TransportFactory.php:36
Symfony\Component\Messenger\Transport\TransportFactory->createTransport() at /opt/project/var/cache/dev/ContainerUghmqjF/getMessenger_Transport_NotificationJsonService.php:26
ContainerUghmqjF\getMessenger_Transport_NotificationJsonService::do() at /opt/project/var/cache/dev/ContainerUghmqjF/HicceArs_KernelDevDebugContainer.php:924
ContainerUghmqjF\HicceArs_KernelDevDebugContainer->load() at /opt/project/var/cache/dev/ContainerUghmqjF/getDoctrine_Orm_Messenger_DoctrineSchemaSubscriberService.php:29
ContainerUghmqjF\getDoctrine_Orm_Messenger_DoctrineSchemaSubscriberService::ContainerUghmqjF\{closure}() at /opt/project/vendor/symfony/doctrine-bridge/SchemaListener/MessengerTransportDoctrineSchemaSubscriber.php:44
Symfony\Bridge\Doctrine\SchemaListener\MessengerTransportDoctrineSchemaSubscriber->postGenerateSchema() at /opt/project/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:68
Symfony\Bridge\Doctrine\ContainerAwareEventManager->dispatchEvent() at /opt/project/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaTool.php:411
Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata() at /opt/project/vendor/doctrine/migrations/lib/Doctrine/Migrations/Provider/OrmSchemaProvider.php:50
Doctrine\Migrations\Provider\OrmSchemaProvider->createSchema() at /opt/project/vendor/doctrine/migrations/lib/Doctrine/Migrations/Generator/DiffGenerator.php:135
Doctrine\Migrations\Generator\DiffGenerator->createToSchema() at /opt/project/vendor/doctrine/migrations/lib/Doctrine/Migrations/Generator/DiffGenerator.php:90
Doctrine\Migrations\Generator\DiffGenerator->generate() at /opt/project/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/DiffCommand.php:154
Doctrine\Migrations\Tools\Console\Command\DiffCommand->execute() at /opt/project/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at /opt/project/vendor/symfony/console/Application.php:1046
Symfony\Component\Console\Application->doRunCommand() at /opt/project/vendor/symfony/framework-bundle/Console/Application.php:96
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /opt/project/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at /opt/project/vendor/symfony/framework-bundle/Console/Application.php:82
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /opt/project/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /opt/project/bin/console:41
doctrine:migrations:diff [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--namespace NAMESPACE] [--filter-expression FILTER-EXPRESSION] [--formatted] [--line-length LINE-LENGTH] [--check-database-platform [CHECK-DATABASE-PLATFORM]] [--allow-empty-diff] [--from-empty-schema]
[root@86f7c8606725 project]#
Here the most interesting line IMO: Symfony\Bridge\Doctrine\SchemaListener\MessengerTransportDoctrineSchemaSubscriber->postGenerateSchema()
That class was introduced in symfony/symfony#36655
Please report this to Symfony.