bug #35912 [FrameworkBundle] register only existing transport factories (xabbuh)
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] register only existing transport factories
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #35866
| License | MIT
| Doc PR |
The parts from #35907 that also apply to the `4.4` branch.
Commits
-------
650c9f3f4b
register only existing transport factories
This commit is contained in:
commit
4ab87747ad
@ -87,6 +87,8 @@ use Symfony\Component\Mailer\Mailer;
|
|||||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||||
use Symfony\Component\Messenger\MessageBus;
|
use Symfony\Component\Messenger\MessageBus;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory;
|
||||||
|
use Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory;
|
||||||
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
|
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
|
||||||
use Symfony\Component\Messenger\Transport\TransportInterface;
|
use Symfony\Component\Messenger\Transport\TransportInterface;
|
||||||
use Symfony\Component\Mime\MimeTypeGuesserInterface;
|
use Symfony\Component\Mime\MimeTypeGuesserInterface;
|
||||||
@ -314,6 +316,16 @@ class FrameworkExtension extends Extension
|
|||||||
$container->removeDefinition('console.command.messenger_failed_messages_show');
|
$container->removeDefinition('console.command.messenger_failed_messages_show');
|
||||||
$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)) {
|
||||||
|
$container->getDefinition('messenger.transport.amqp.factory')
|
||||||
|
->addTag('messenger.transport_factory');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($container->hasDefinition('messenger.transport.redis.factory') && class_exists(RedisTransportFactory::class)) {
|
||||||
|
$container->getDefinition('messenger.transport.redis.factory')
|
||||||
|
->addTag('messenger.transport_factory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->httpClientConfigEnabled = $this->isConfigEnabled($container, $config['http_client'])) {
|
if ($this->httpClientConfigEnabled = $this->isConfigEnabled($container, $config['http_client'])) {
|
||||||
@ -1707,6 +1719,14 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
$loader->load('messenger.xml');
|
$loader->load('messenger.xml');
|
||||||
|
|
||||||
|
if (class_exists(AmqpTransportFactory::class)) {
|
||||||
|
$container->getDefinition('messenger.transport.amqp.factory')->addTag('messenger.transport_factory');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (class_exists(RedisTransportFactory::class)) {
|
||||||
|
$container->getDefinition('messenger.transport.redis.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']);
|
||||||
}
|
}
|
||||||
|
@ -67,13 +67,9 @@
|
|||||||
<argument type="tagged_iterator" tag="messenger.transport_factory" />
|
<argument type="tagged_iterator" tag="messenger.transport_factory" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="messenger.transport.amqp.factory" class="Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory">
|
<service id="messenger.transport.amqp.factory" class="Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory"/>
|
||||||
<tag name="messenger.transport_factory" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="messenger.transport.redis.factory" class="Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory">
|
<service id="messenger.transport.redis.factory" class="Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory"/>
|
||||||
<tag name="messenger.transport_factory" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="messenger.transport.sync.factory" class="Symfony\Component\Messenger\Transport\Sync\SyncTransportFactory">
|
<service id="messenger.transport.sync.factory" class="Symfony\Component\Messenger\Transport\Sync\SyncTransportFactory">
|
||||||
<tag name="messenger.transport_factory" />
|
<tag name="messenger.transport_factory" />
|
||||||
|
Reference in New Issue
Block a user