register only existing transport factories
This commit is contained in:
parent
645ccc8eac
commit
24322cffdb
@ -81,6 +81,7 @@ use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
|
|||||||
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
|
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
|
||||||
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
|
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
|
||||||
use Symfony\Component\Mailer\Mailer;
|
use Symfony\Component\Mailer\Mailer;
|
||||||
|
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
|
||||||
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
|
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
|
||||||
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory;
|
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory;
|
||||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||||
@ -321,14 +322,24 @@ class FrameworkExtension extends Extension
|
|||||||
$container->removeDefinition('console.command.messenger_failed_messages_remove');
|
$container->removeDefinition('console.command.messenger_failed_messages_remove');
|
||||||
$container->removeDefinition('cache.messenger.restart_workers_signal');
|
$container->removeDefinition('cache.messenger.restart_workers_signal');
|
||||||
|
|
||||||
if ($container->hasDefinition('messenger.transport.amqp.factory') && class_exists(AmqpTransportFactory::class)) {
|
if ($container->hasDefinition('messenger.transport.amqp.factory') && !class_exists(AmqpTransportFactory::class)) {
|
||||||
$container->getDefinition('messenger.transport.amqp.factory')
|
if (class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class)) {
|
||||||
->addTag('messenger.transport_factory');
|
$container->getDefinition('messenger.transport.amqp.factory')
|
||||||
|
->setClass(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class)
|
||||||
|
->addTag('messenger.transport_factory');
|
||||||
|
} else {
|
||||||
|
$container->removeDefinition('messenger.transport.amqp.factory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($container->hasDefinition('messenger.transport.redis.factory') && class_exists(RedisTransportFactory::class)) {
|
if ($container->hasDefinition('messenger.transport.redis.factory') && !class_exists(RedisTransportFactory::class)) {
|
||||||
$container->getDefinition('messenger.transport.redis.factory')
|
if (class_exists(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class)) {
|
||||||
->addTag('messenger.transport_factory');
|
$container->getDefinition('messenger.transport.redis.factory')
|
||||||
|
->setClass(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class)
|
||||||
|
->addTag('messenger.transport_factory');
|
||||||
|
} else {
|
||||||
|
$container->removeDefinition('messenger.transport.redis.factory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1615,6 +1626,10 @@ class FrameworkExtension extends Extension
|
|||||||
$container->getDefinition('messenger.transport.redis.factory')->addTag('messenger.transport_factory');
|
$container->getDefinition('messenger.transport.redis.factory')->addTag('messenger.transport_factory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class_exists(AmazonSqsTransportFactory::class)) {
|
||||||
|
$container->getDefinition('messenger.transport.sqs.factory')->addTag('messenger.transport_factory');
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $config['default_bus'] && 1 === \count($config['buses'])) {
|
if (null === $config['default_bus'] && 1 === \count($config['buses'])) {
|
||||||
$config['default_bus'] = key($config['buses']);
|
$config['default_bus'] = key($config['buses']);
|
||||||
}
|
}
|
||||||
@ -1672,6 +1687,7 @@ class FrameworkExtension extends Extension
|
|||||||
$container->removeDefinition('messenger.transport.symfony_serializer');
|
$container->removeDefinition('messenger.transport.symfony_serializer');
|
||||||
$container->removeDefinition('messenger.transport.amqp.factory');
|
$container->removeDefinition('messenger.transport.amqp.factory');
|
||||||
$container->removeDefinition('messenger.transport.redis.factory');
|
$container->removeDefinition('messenger.transport.redis.factory');
|
||||||
|
$container->removeDefinition('messenger.transport.sqs.factory');
|
||||||
} else {
|
} else {
|
||||||
$container->getDefinition('messenger.transport.symfony_serializer')
|
$container->getDefinition('messenger.transport.symfony_serializer')
|
||||||
->replaceArgument(1, $config['serializer']['symfony_serializer']['format'])
|
->replaceArgument(1, $config['serializer']['symfony_serializer']['format'])
|
||||||
|
@ -81,9 +81,7 @@
|
|||||||
<tag name="kernel.reset" method="reset" />
|
<tag name="kernel.reset" method="reset" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="messenger.transport.sqs.factory" class="Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory">
|
<service id="messenger.transport.sqs.factory" class="Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory"/>
|
||||||
<tag name="messenger.transport_factory" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<!-- retry -->
|
<!-- retry -->
|
||||||
<service id="messenger.retry_strategy_locator">
|
<service id="messenger.retry_strategy_locator">
|
||||||
|
Reference in New Issue
Block a user