@@ -321,20 +321,14 @@ public function load(array $configs, ContainerBuilder $container)
321
321
$ container ->removeDefinition ('console.command.messenger_failed_messages_remove ' );
322
322
$ container ->removeDefinition ('cache.messenger.restart_workers_signal ' );
323
323
324
- if ($ container ->hasDefinition ('messenger.transport.amqp.factory ' ) && !class_exists (AmqpTransportFactory::class)) {
325
- if (class_exists (\Symfony \Component \Messenger \Transport \AmqpExt \AmqpTransportFactory::class)) {
326
- $ container ->getDefinition ('messenger.transport.amqp.factory ' )->setClass (\Symfony \Component \Messenger \Transport \AmqpExt \AmqpTransportFactory::class);
327
- } else {
328
- $ container ->removeDefinition ('messenger.transport.amqp.factory ' );
329
- }
324
+ if ($ container ->hasDefinition ('messenger.transport.amqp.factory ' ) && class_exists (AmqpTransportFactory::class)) {
325
+ $ container ->getDefinition ('messenger.transport.amqp.factory ' )
326
+ ->addTag ('messenger.transport_factory ' );
330
327
}
331
328
332
- if ($ container ->hasDefinition ('messenger.transport.redis.factory ' ) && !class_exists (RedisTransportFactory::class)) {
333
- if (class_exists (\Symfony \Component \Messenger \Transport \RedisExt \RedisTransportFactory::class)) {
334
- $ container ->getDefinition ('messenger.transport.redis.factory ' )->setClass (\Symfony \Component \Messenger \Transport \RedisExt \RedisTransportFactory::class);
335
- } else {
336
- $ container ->removeDefinition ('messenger.transport.redis.factory ' );
337
- }
329
+ if ($ container ->hasDefinition ('messenger.transport.redis.factory ' ) && class_exists (RedisTransportFactory::class)) {
330
+ $ container ->getDefinition ('messenger.transport.redis.factory ' )
331
+ ->addTag ('messenger.transport_factory ' );
338
332
}
339
333
}
340
334
@@ -1613,6 +1607,14 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
1613
1607
1614
1608
$ loader ->load ('messenger.xml ' );
1615
1609
1610
+ if (class_exists (AmqpTransportFactory::class)) {
1611
+ $ container ->getDefinition ('messenger.transport.amqp.factory ' )->addTag ('messenger.transport_factory ' );
1612
+ }
1613
+
1614
+ if (class_exists (RedisTransportFactory::class)) {
1615
+ $ container ->getDefinition ('messenger.transport.redis.factory ' )->addTag ('messenger.transport_factory ' );
1616
+ }
1617
+
1616
1618
if (null === $ config ['default_bus ' ] && 1 === \count ($ config ['buses ' ])) {
1617
1619
$ config ['default_bus ' ] = key ($ config ['buses ' ]);
1618
1620
}
0 commit comments