[Messenger] Fix bug when using single route with XML config
This commit is contained in:
parent
592a31a5e6
commit
a2a606e897
@ -1193,6 +1193,10 @@ class Configuration implements ConfigurationInterface
|
|||||||
if (!\is_array($config)) {
|
if (!\is_array($config)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
// If XML config with only one routing attribute
|
||||||
|
if (2 === \count($config) && isset($config['message-class']) && isset($config['sender'])) {
|
||||||
|
$config = [0 => $config];
|
||||||
|
}
|
||||||
|
|
||||||
$newConfig = [];
|
$newConfig = [];
|
||||||
foreach ($config as $k => $v) {
|
foreach ($config as $k => $v) {
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$container->loadFromExtension('framework', [
|
||||||
|
'messenger' => [
|
||||||
|
'routing' => [
|
||||||
|
'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage' => ['amqp'],
|
||||||
|
],
|
||||||
|
'transports' => [
|
||||||
|
'amqp' => 'amqp://localhost/%2f/messages',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<container xmlns="http://symfony.com/schema/dic/services"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||||
|
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
|
||||||
|
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||||
|
|
||||||
|
<framework:config>
|
||||||
|
<framework:messenger>
|
||||||
|
<framework:routing message-class="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage">
|
||||||
|
<framework:sender service="amqp" />
|
||||||
|
</framework:routing>
|
||||||
|
<framework:transport name="amqp" dsn="amqp://localhost/%2f/messages" />
|
||||||
|
</framework:messenger>
|
||||||
|
</framework:config>
|
||||||
|
</container>
|
@ -0,0 +1,7 @@
|
|||||||
|
framework:
|
||||||
|
messenger:
|
||||||
|
routing:
|
||||||
|
'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage': [amqp]
|
||||||
|
|
||||||
|
transports:
|
||||||
|
amqp: 'amqp://localhost/%2f/messages'
|
@ -740,6 +740,15 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertEquals(new Reference('messenger.transport.audit'), $sendersLocator->getArgument(0)['messenger.transport.audit']->getValues()[0]);
|
$this->assertEquals(new Reference('messenger.transport.audit'), $sendersLocator->getArgument(0)['messenger.transport.audit']->getValues()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMessengerRoutingSingle()
|
||||||
|
{
|
||||||
|
$container = $this->createContainerFromFile('messenger_routing_single');
|
||||||
|
$senderLocatorDefinition = $container->getDefinition('messenger.senders_locator');
|
||||||
|
|
||||||
|
$sendersMapping = $senderLocatorDefinition->getArgument(0);
|
||||||
|
$this->assertEquals(['amqp'], $sendersMapping[DummyMessage::class]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testMessengerTransportConfiguration()
|
public function testMessengerTransportConfiguration()
|
||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('messenger_transport');
|
$container = $this->createContainerFromFile('messenger_transport');
|
||||||
|
Reference in New Issue
Block a user