minor #27129 [Messenger] Rename Adapters to Transports (sroze)
This PR was squashed before being merged into the 4.1-dev branch (closes #27129).
Discussion
----------
[Messenger] Rename Adapters to Transports
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
Last of our tasks on the "plan to beta", renaming "adapters" to "transports". This is a term that makes more sense and is commonly used within the "queue community".
Commits
-------
13b747565f
[Messenger] Rename Adapters to Transports
This commit is contained in:
commit
47da23c7cb
@ -13,7 +13,7 @@ namespace Symfony\Bridge\Doctrine\Messenger;
|
|||||||
|
|
||||||
use Doctrine\Common\Persistence\ManagerRegistry;
|
use Doctrine\Common\Persistence\ManagerRegistry;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps all handlers in a single doctrine transaction.
|
* Wraps all handlers in a single doctrine transaction.
|
||||||
|
@ -971,7 +971,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('messenger')
|
->arrayNode('messenger')
|
||||||
->info('Messenger configuration')
|
->info('Messenger configuration')
|
||||||
->{!class_exists(FullStack::class) && interface_exists(MessageBusInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
|
->{!class_exists(FullStack::class) && interface_exists(MessageBusInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
|
||||||
->fixXmlConfig('adapter')
|
->fixXmlConfig('transport')
|
||||||
->fixXmlConfig('bus', 'buses')
|
->fixXmlConfig('bus', 'buses')
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('routing')
|
->arrayNode('routing')
|
||||||
@ -1024,7 +1024,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->scalarNode('encoder')->defaultValue('messenger.transport.serializer')->end()
|
->scalarNode('encoder')->defaultValue('messenger.transport.serializer')->end()
|
||||||
->scalarNode('decoder')->defaultValue('messenger.transport.serializer')->end()
|
->scalarNode('decoder')->defaultValue('messenger.transport.serializer')->end()
|
||||||
->arrayNode('adapters')
|
->arrayNode('transports')
|
||||||
->useAttributeAsKey('name')
|
->useAttributeAsKey('name')
|
||||||
->arrayPrototype()
|
->arrayPrototype()
|
||||||
->beforeNormalization()
|
->beforeNormalization()
|
||||||
|
@ -1449,7 +1449,7 @@ class FrameworkExtension extends Extension
|
|||||||
$loader->load('messenger.xml');
|
$loader->load('messenger.xml');
|
||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['serializer'])) {
|
if ($this->isConfigEnabled($container, $config['serializer'])) {
|
||||||
if (\count($config['adapters']) > 0 && !$this->isConfigEnabled($container, $serializerConfig)) {
|
if (\count($config['transports']) > 0 && !$this->isConfigEnabled($container, $serializerConfig)) {
|
||||||
throw new LogicException('Using the default encoder/decoder, Symfony Messenger requires the Serializer. Enable it or install it by running "composer require symfony/serializer-pack".');
|
throw new LogicException('Using the default encoder/decoder, Symfony Messenger requires the Serializer. Enable it or install it by running "composer require symfony/serializer-pack".');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1505,17 +1505,17 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
$container->getDefinition('messenger.asynchronous.routing.sender_locator')->replaceArgument(1, $messageToSenderIdsMapping);
|
$container->getDefinition('messenger.asynchronous.routing.sender_locator')->replaceArgument(1, $messageToSenderIdsMapping);
|
||||||
|
|
||||||
foreach ($config['adapters'] as $name => $adapter) {
|
foreach ($config['transports'] as $name => $transport) {
|
||||||
$senderDefinition = (new Definition(SenderInterface::class))
|
$senderDefinition = (new Definition(SenderInterface::class))
|
||||||
->setFactory(array(new Reference('messenger.adapter_factory'), 'createSender'))
|
->setFactory(array(new Reference('messenger.transport_factory'), 'createSender'))
|
||||||
->setArguments(array($adapter['dsn'], $adapter['options']))
|
->setArguments(array($transport['dsn'], $transport['options']))
|
||||||
->addTag('messenger.sender', array('name' => $name))
|
->addTag('messenger.sender', array('name' => $name))
|
||||||
;
|
;
|
||||||
$container->setDefinition('messenger.sender.'.$name, $senderDefinition);
|
$container->setDefinition('messenger.sender.'.$name, $senderDefinition);
|
||||||
|
|
||||||
$receiverDefinition = (new Definition(ReceiverInterface::class))
|
$receiverDefinition = (new Definition(ReceiverInterface::class))
|
||||||
->setFactory(array(new Reference('messenger.adapter_factory'), 'createReceiver'))
|
->setFactory(array(new Reference('messenger.transport_factory'), 'createReceiver'))
|
||||||
->setArguments(array($adapter['dsn'], $adapter['options']))
|
->setArguments(array($transport['dsn'], $transport['options']))
|
||||||
->addTag('messenger.receiver', array('name' => $name))
|
->addTag('messenger.receiver', array('name' => $name))
|
||||||
;
|
;
|
||||||
$container->setDefinition('messenger.receiver.'.$name, $receiverDefinition);
|
$container->setDefinition('messenger.receiver.'.$name, $receiverDefinition);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<defaults public="false" />
|
<defaults public="false" />
|
||||||
|
|
||||||
<!-- Handlers -->
|
<!-- Handlers -->
|
||||||
<service id="messenger.handler_resolver" class="Symfony\Component\Messenger\ContainerHandlerLocator">
|
<service id="messenger.handler_resolver" class="Symfony\Component\Messenger\Handler\Locator\ContainerHandlerLocator">
|
||||||
<argument type="service" id="service_container"/>
|
<argument type="service" id="service_container"/>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
@ -60,16 +60,16 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<!-- Adapters -->
|
<!-- Adapters -->
|
||||||
<service id="messenger.adapter_factory" class="Symfony\Component\Messenger\Adapter\Factory\ChainAdapterFactory">
|
<service id="messenger.transport_factory" class="Symfony\Component\Messenger\Transport\Factory\ChainTransportFactory">
|
||||||
<argument type="tagged" tag="messenger.adapter_factory" />
|
<argument type="tagged" tag="messenger.transport_factory" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="messenger.adapter.amqp.factory" class="Symfony\Component\Messenger\Adapter\AmqpExt\AmqpAdapterFactory">
|
<service id="messenger.adapter.amqp.factory" class="Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory">
|
||||||
<argument type="service" id="messenger.transport.encoder" />
|
<argument type="service" id="messenger.transport.encoder" />
|
||||||
<argument type="service" id="messenger.transport.decoder" />
|
<argument type="service" id="messenger.transport.decoder" />
|
||||||
<argument>%kernel.debug%</argument>
|
<argument>%kernel.debug%</argument>
|
||||||
|
|
||||||
<tag name="messenger.adapter_factory" />
|
<tag name="messenger.transport_factory" />
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -356,7 +356,7 @@
|
|||||||
<xsd:element name="encoder" type="xsd:string" minOccurs="0" />
|
<xsd:element name="encoder" type="xsd:string" minOccurs="0" />
|
||||||
<xsd:element name="decoder" type="xsd:string" minOccurs="0" />
|
<xsd:element name="decoder" type="xsd:string" minOccurs="0" />
|
||||||
<xsd:element name="routing" type="messenger_routing" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="routing" type="messenger_routing" minOccurs="0" maxOccurs="unbounded" />
|
||||||
<xsd:element name="adapter" type="messenger_adapter" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="transport" type="messenger_transport" minOccurs="0" maxOccurs="unbounded" />
|
||||||
<xsd:element name="bus" type="messenger_bus" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="bus" type="messenger_bus" minOccurs="0" maxOccurs="unbounded" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="default-bus" type="xsd:string" />
|
<xsd:attribute name="default-bus" type="xsd:string" />
|
||||||
@ -381,7 +381,7 @@
|
|||||||
<xsd:attribute name="service" type="xsd:string" use="required"/>
|
<xsd:attribute name="service" type="xsd:string" use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="messenger_adapter">
|
<xsd:complexType name="messenger_transport">
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="options" type="metadata" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="options" type="metadata" minOccurs="0" maxOccurs="unbounded" />
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
@ -389,11 +389,6 @@
|
|||||||
<xsd:attribute name="dsn" type="xsd:string" />
|
<xsd:attribute name="dsn" type="xsd:string" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
||||||
<xsd:complexType name="messenger_adapter_option">
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="value" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
<xsd:complexType name="messenger_bus">
|
<xsd:complexType name="messenger_bus">
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="middleware" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
<xsd:element name="middleware" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||||
|
@ -254,7 +254,7 @@ class ConfigurationTest extends TestCase
|
|||||||
'messenger' => array(
|
'messenger' => array(
|
||||||
'enabled' => !class_exists(FullStack::class) && interface_exists(MessageBusInterface::class),
|
'enabled' => !class_exists(FullStack::class) && interface_exists(MessageBusInterface::class),
|
||||||
'routing' => array(),
|
'routing' => array(),
|
||||||
'adapters' => array(),
|
'transports' => array(),
|
||||||
'serializer' => array(
|
'serializer' => array(
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'format' => 'json',
|
'format' => 'json',
|
||||||
|
@ -8,7 +8,7 @@ $container->loadFromExtension('framework', array(
|
|||||||
'serializer' => array(
|
'serializer' => array(
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
),
|
),
|
||||||
'adapters' => array(
|
'transports' => array(
|
||||||
'default' => 'amqp://localhost/%2f/messages',
|
'default' => 'amqp://localhost/%2f/messages',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
$container->loadFromExtension('framework', array(
|
$container->loadFromExtension('framework', array(
|
||||||
'serializer' => true,
|
'serializer' => true,
|
||||||
'messenger' => array(
|
'messenger' => array(
|
||||||
'adapters' => array(
|
'transports' => array(
|
||||||
'default' => 'amqp://localhost/%2f/messages',
|
'default' => 'amqp://localhost/%2f/messages',
|
||||||
'customised' => array(
|
'customised' => array(
|
||||||
'dsn' => 'amqp://localhost/%2f/messages?exchange_name=exchange_name',
|
'dsn' => 'amqp://localhost/%2f/messages?exchange_name=exchange_name',
|
@ -9,7 +9,7 @@
|
|||||||
<framework:serializer enabled="false" />
|
<framework:serializer enabled="false" />
|
||||||
<framework:messenger>
|
<framework:messenger>
|
||||||
<framework:serializer enabled="true" />
|
<framework:serializer enabled="true" />
|
||||||
<framework:adapter name="default" dsn="amqp://localhost/%2f/messages" />
|
<framework:transport name="default" dsn="amqp://localhost/%2f/messages" />
|
||||||
</framework:messenger>
|
</framework:messenger>
|
||||||
</framework:config>
|
</framework:config>
|
||||||
</container>
|
</container>
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
<framework:config>
|
<framework:config>
|
||||||
<framework:serializer enabled="true" />
|
<framework:serializer enabled="true" />
|
||||||
<framework:messenger>
|
<framework:messenger>
|
||||||
<framework:adapter name="default" dsn="amqp://localhost/%2f/messages" />
|
<framework:transport name="default" dsn="amqp://localhost/%2f/messages" />
|
||||||
<framework:adapter name="customised" dsn="amqp://localhost/%2f/messages?exchange_name=exchange_name">
|
<framework:transport name="customised" dsn="amqp://localhost/%2f/messages?exchange_name=exchange_name">
|
||||||
<framework:options>
|
<framework:options>
|
||||||
<framework:queue>
|
<framework:queue>
|
||||||
<framework:name>Queue</framework:name>
|
<framework:name>Queue</framework:name>
|
||||||
</framework:queue>
|
</framework:queue>
|
||||||
</framework:options>
|
</framework:options>
|
||||||
</framework:adapter>
|
</framework:transport>
|
||||||
</framework:messenger>
|
</framework:messenger>
|
||||||
</framework:config>
|
</framework:config>
|
||||||
</container>
|
</container>
|
@ -4,5 +4,5 @@ framework:
|
|||||||
messenger:
|
messenger:
|
||||||
serializer:
|
serializer:
|
||||||
enabled: true
|
enabled: true
|
||||||
adapters:
|
transports:
|
||||||
default: 'amqp://localhost/%2f/messages'
|
default: 'amqp://localhost/%2f/messages'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
framework:
|
framework:
|
||||||
serializer: true
|
serializer: true
|
||||||
messenger:
|
messenger:
|
||||||
adapters:
|
transports:
|
||||||
default: 'amqp://localhost/%2f/messages'
|
default: 'amqp://localhost/%2f/messages'
|
||||||
customised:
|
customised:
|
||||||
dsn: 'amqp://localhost/%2f/messages?exchange_name=exchange_name'
|
dsn: 'amqp://localhost/%2f/messages?exchange_name=exchange_name'
|
@ -529,9 +529,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertTrue($container->has('message_bus'));
|
$this->assertTrue($container->has('message_bus'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessengerAdapter()
|
public function testMessengerTransports()
|
||||||
{
|
{
|
||||||
$container = $this->createContainerFromFile('messenger_adapter');
|
$container = $this->createContainerFromFile('messenger_transports');
|
||||||
$this->assertTrue($container->hasDefinition('messenger.sender.default'));
|
$this->assertTrue($container->hasDefinition('messenger.sender.default'));
|
||||||
$this->assertTrue($container->getDefinition('messenger.sender.default')->hasTag('messenger.sender'));
|
$this->assertTrue($container->getDefinition('messenger.sender.default')->hasTag('messenger.sender'));
|
||||||
$this->assertEquals(array(array('name' => 'default')), $container->getDefinition('messenger.sender.default')->getTag('messenger.sender'));
|
$this->assertEquals(array(array('name' => 'default')), $container->getDefinition('messenger.sender.default')->getTag('messenger.sender'));
|
||||||
@ -543,7 +543,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$senderFactory = $container->getDefinition('messenger.sender.customised')->getFactory();
|
$senderFactory = $container->getDefinition('messenger.sender.customised')->getFactory();
|
||||||
$senderArguments = $container->getDefinition('messenger.sender.customised')->getArguments();
|
$senderArguments = $container->getDefinition('messenger.sender.customised')->getArguments();
|
||||||
|
|
||||||
$this->assertEquals(array(new Reference('messenger.adapter_factory'), 'createSender'), $senderFactory);
|
$this->assertEquals(array(new Reference('messenger.transport_factory'), 'createSender'), $senderFactory);
|
||||||
$this->assertCount(2, $senderArguments);
|
$this->assertCount(2, $senderArguments);
|
||||||
$this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $senderArguments[0]);
|
$this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $senderArguments[0]);
|
||||||
$this->assertSame(array('queue' => array('name' => 'Queue')), $senderArguments[1]);
|
$this->assertSame(array('queue' => array('name' => 'Queue')), $senderArguments[1]);
|
||||||
@ -552,7 +552,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$receiverFactory = $container->getDefinition('messenger.receiver.customised')->getFactory();
|
$receiverFactory = $container->getDefinition('messenger.receiver.customised')->getFactory();
|
||||||
$receiverArguments = $container->getDefinition('messenger.receiver.customised')->getArguments();
|
$receiverArguments = $container->getDefinition('messenger.receiver.customised')->getArguments();
|
||||||
|
|
||||||
$this->assertEquals(array(new Reference('messenger.adapter_factory'), 'createReceiver'), $receiverFactory);
|
$this->assertEquals(array(new Reference('messenger.transport_factory'), 'createReceiver'), $receiverFactory);
|
||||||
$this->assertCount(2, $receiverArguments);
|
$this->assertCount(2, $receiverArguments);
|
||||||
$this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $receiverArguments[0]);
|
$this->assertSame('amqp://localhost/%2f/messages?exchange_name=exchange_name', $receiverArguments[0]);
|
||||||
$this->assertSame(array('queue' => array('name' => 'Queue')), $receiverArguments[1]);
|
$this->assertSame(array('queue' => array('name' => 'Queue')), $receiverArguments[1]);
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\Messenger\Asynchronous\Middleware;
|
|||||||
|
|
||||||
use Symfony\Component\Messenger\Asynchronous\Routing\SenderLocatorInterface;
|
use Symfony\Component\Messenger\Asynchronous\Routing\SenderLocatorInterface;
|
||||||
use Symfony\Component\Messenger\Asynchronous\Transport\ReceivedMessage;
|
use Symfony\Component\Messenger\Asynchronous\Transport\ReceivedMessage;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger;
|
namespace Symfony\Component\Messenger\Handler\Locator;
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger;
|
namespace Symfony\Component\Messenger\Handler\Locator;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger;
|
namespace Symfony\Component\Messenger\Handler\Locator;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
||||||
|
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Messenger;
|
namespace Symfony\Component\Messenger;
|
||||||
|
|
||||||
|
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
* @author Matthias Noback <matthiasnoback@gmail.com>
|
* @author Matthias Noback <matthiasnoback@gmail.com>
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Messenger\Middleware;
|
namespace Symfony\Component\Messenger\Middleware;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
use Symfony\Component\Messenger\Handler\Locator\HandlerLocatorInterface;
|
||||||
use Symfony\Component\Messenger\HandlerLocatorInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Component\Messenger\Middleware;
|
namespace Symfony\Component\Messenger\Middleware;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Asynchronous\Transport\ReceivedMessage;
|
use Symfony\Component\Messenger\Asynchronous\Transport\ReceivedMessage;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger;
|
namespace Symfony\Component\Messenger\Middleware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Component\Messenger\Middleware;
|
namespace Symfony\Component\Messenger\Middleware;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
use Symfony\Component\Messenger\Exception\NoHandlerForMessageException;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace Symfony\Component\Messenger\Middleware;
|
namespace Symfony\Component\Messenger\Middleware;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Exception\ValidationFailedException;
|
use Symfony\Component\Messenger\Exception\ValidationFailedException;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,16 +16,16 @@ use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\ServiceLocator;
|
use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpReceiver;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpSender;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender;
|
||||||
use Symfony\Component\Messenger\ContainerHandlerLocator;
|
use Symfony\Component\Messenger\Handler\Locator\ContainerHandlerLocator;
|
||||||
use Symfony\Component\Messenger\DataCollector\MessengerDataCollector;
|
use Symfony\Component\Messenger\DataCollector\MessengerDataCollector;
|
||||||
use Symfony\Component\Messenger\DependencyInjection\MessengerPass;
|
use Symfony\Component\Messenger\DependencyInjection\MessengerPass;
|
||||||
use Symfony\Component\Messenger\Handler\ChainHandler;
|
use Symfony\Component\Messenger\Handler\ChainHandler;
|
||||||
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
|
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Messenger\Middleware\TolerateNoHandler;
|
use Symfony\Component\Messenger\Middleware\TolerateNoHandler;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\SecondMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\SecondMessage;
|
||||||
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
||||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Messenger\Tests;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\MessageBus;
|
use Symfony\Component\Messenger\MessageBus;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Messenger\MiddlewareInterface;
|
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
|
|
||||||
class MessageBusTest extends TestCase
|
class MessageBusTest extends TestCase
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Messenger\Tests\Middleware;
|
namespace Symfony\Component\Messenger\Tests\Middleware;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\HandlerLocator;
|
use Symfony\Component\Messenger\Handler\Locator\HandlerLocator;
|
||||||
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
|
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Tests\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Tests\Transport\AmqpExt;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpReceiver;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpSender;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Connection;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Connection;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
||||||
use Symfony\Component\Process\PhpProcess;
|
use Symfony\Component\Process\PhpProcess;
|
@ -9,12 +9,12 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Tests\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Tests\Transport\AmqpExt;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpReceiver;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Connection;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Connection;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Exception\RejectMessageExceptionInterface;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Exception\RejectMessageExceptionInterface;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
||||||
use Symfony\Component\Serializer as SerializerComponent;
|
use Symfony\Component\Serializer as SerializerComponent;
|
||||||
@ -51,7 +51,7 @@ class AmqpReceiverTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Messenger\Tests\Adapter\AmqpExt\InterruptException
|
* @expectedException \Symfony\Component\Messenger\Tests\Transport\AmqpExt\InterruptException
|
||||||
*/
|
*/
|
||||||
public function testItNonAcknowledgeTheMessageIfAnExceptionHappened()
|
public function testItNonAcknowledgeTheMessageIfAnExceptionHappened()
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ class AmqpReceiverTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Messenger\Tests\Adapter\AmqpExt\WillNeverWorkException
|
* @expectedException \Symfony\Component\Messenger\Tests\Transport\AmqpExt\WillNeverWorkException
|
||||||
*/
|
*/
|
||||||
public function testItRejectsTheMessageIfTheExceptionIsARejectMessageExceptionInterface()
|
public function testItRejectsTheMessageIfTheExceptionIsARejectMessageExceptionInterface()
|
||||||
{
|
{
|
@ -9,10 +9,10 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Tests\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Tests\Transport\AmqpExt;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpSender;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Connection;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Connection;
|
||||||
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\EncoderInterface;
|
use Symfony\Component\Messenger\Transport\Serialization\EncoderInterface;
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Tests\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Tests\Transport\AmqpExt;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpFactory;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpFactory;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Connection;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires extension amqp
|
* @requires extension amqp
|
@ -12,9 +12,9 @@ if (!file_exists($autoload)) {
|
|||||||
|
|
||||||
require_once $autoload;
|
require_once $autoload;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpReceiver;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\AmqpSender;
|
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender;
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Connection;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Connection;
|
||||||
use Symfony\Component\Messenger\MessageBusInterface;
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
|
||||||
use Symfony\Component\Messenger\Worker;
|
use Symfony\Component\Messenger\Worker;
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||||
|
|
||||||
class AmqpFactory
|
class AmqpFactory
|
||||||
{
|
{
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Adapter\AmqpExt\Exception\RejectMessageExceptionInterface;
|
use Symfony\Component\Messenger\Transport\AmqpExt\Exception\RejectMessageExceptionInterface;
|
||||||
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\DecoderInterface;
|
use Symfony\Component\Messenger\Transport\Serialization\DecoderInterface;
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Transport\SenderInterface;
|
use Symfony\Component\Messenger\Transport\SenderInterface;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\EncoderInterface;
|
use Symfony\Component\Messenger\Transport\Serialization\EncoderInterface;
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Adapter\Factory\AdapterFactoryInterface;
|
use Symfony\Component\Messenger\Transport\Factory\TransportFactoryInterface;
|
||||||
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
||||||
use Symfony\Component\Messenger\Transport\SenderInterface;
|
use Symfony\Component\Messenger\Transport\SenderInterface;
|
||||||
use Symfony\Component\Messenger\Transport\Serialization\DecoderInterface;
|
use Symfony\Component\Messenger\Transport\Serialization\DecoderInterface;
|
||||||
@ -20,7 +20,7 @@ use Symfony\Component\Messenger\Transport\Serialization\EncoderInterface;
|
|||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
*/
|
*/
|
||||||
class AmqpAdapterFactory implements AdapterFactoryInterface
|
class AmqpTransportFactory implements TransportFactoryInterface
|
||||||
{
|
{
|
||||||
private $encoder;
|
private $encoder;
|
||||||
private $decoder;
|
private $decoder;
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AMQP connection.
|
* An AMQP connection.
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\AmqpExt\Exception;
|
namespace Symfony\Component\Messenger\Transport\AmqpExt\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If something goes wrong while consuming and handling a message from the AMQP broker, there are two choices: rejecting
|
* If something goes wrong while consuming and handling a message from the AMQP broker, there are two choices: rejecting
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\Factory;
|
namespace Symfony\Component\Messenger\Transport\Factory;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
||||||
use Symfony\Component\Messenger\Transport\SenderInterface;
|
use Symfony\Component\Messenger\Transport\SenderInterface;
|
||||||
@ -17,12 +17,12 @@ use Symfony\Component\Messenger\Transport\SenderInterface;
|
|||||||
/**
|
/**
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
*/
|
*/
|
||||||
class ChainAdapterFactory implements AdapterFactoryInterface
|
class ChainTransportFactory implements TransportFactoryInterface
|
||||||
{
|
{
|
||||||
private $factories;
|
private $factories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param iterable|AdapterFactoryInterface[] $factories
|
* @param iterable|TransportFactoryInterface[] $factories
|
||||||
*/
|
*/
|
||||||
public function __construct(iterable $factories)
|
public function __construct(iterable $factories)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ class ChainAdapterFactory implements AdapterFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('No adapter supports the given DSN "%s".', $dsn));
|
throw new \InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createSender(string $dsn, array $options): SenderInterface
|
public function createSender(string $dsn, array $options): SenderInterface
|
||||||
@ -48,7 +48,7 @@ class ChainAdapterFactory implements AdapterFactoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('No adapter supports the given DSN "%s".', $dsn));
|
throw new \InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports(string $dsn, array $options): bool
|
public function supports(string $dsn, array $options): bool
|
@ -9,17 +9,17 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Messenger\Adapter\Factory;
|
namespace Symfony\Component\Messenger\Transport\Factory;
|
||||||
|
|
||||||
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
use Symfony\Component\Messenger\Transport\ReceiverInterface;
|
||||||
use Symfony\Component\Messenger\Transport\SenderInterface;
|
use Symfony\Component\Messenger\Transport\SenderInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Messenger adapter.
|
* Creates a Messenger transport.
|
||||||
*
|
*
|
||||||
* @author Samuel Roze <samuel.roze@gmail.com>
|
* @author Samuel Roze <samuel.roze@gmail.com>
|
||||||
*/
|
*/
|
||||||
interface AdapterFactoryInterface
|
interface TransportFactoryInterface
|
||||||
{
|
{
|
||||||
public function createReceiver(string $dsn, array $options): ReceiverInterface;
|
public function createReceiver(string $dsn, array $options): ReceiverInterface;
|
||||||
|
|
@ -22,7 +22,7 @@ interface DecoderInterface
|
|||||||
* Decodes the message from an encoded-form.
|
* Decodes the message from an encoded-form.
|
||||||
*
|
*
|
||||||
* The `$encodedMessage` parameter is a key-value array that
|
* The `$encodedMessage` parameter is a key-value array that
|
||||||
* describes the message, that will be used by the different adapters.
|
* describes the message, that will be used by the different transports.
|
||||||
*
|
*
|
||||||
* The most common keys are:
|
* The most common keys are:
|
||||||
* - `body` (string) - the message body
|
* - `body` (string) - the message body
|
||||||
|
@ -19,7 +19,7 @@ namespace Symfony\Component\Messenger\Transport\Serialization;
|
|||||||
interface EncoderInterface
|
interface EncoderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Encodes a message to a common format understandable by adapters. The encoded array should only
|
* Encodes a message to a common format understandable by transports. The encoded array should only
|
||||||
* contain scalar and arrays.
|
* contain scalar and arrays.
|
||||||
*
|
*
|
||||||
* The most common keys of the encoded array are:
|
* The most common keys of the encoded array are:
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"symfony/var-dumper": "~3.4|~4.0"
|
"symfony/var-dumper": "~3.4|~4.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"sroze/enqueue-bridge": "For using the php-enqueue library as an adapter."
|
"sroze/enqueue-bridge": "For using the php-enqueue library as a transport."
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\Messenger\\": "" },
|
"psr-4": { "Symfony\\Component\\Messenger\\": "" },
|
||||||
|
Reference in New Issue
Block a user