Skip to content

Commit 2990c8f

Browse files
Nyholmfabpot
authored andcommitted
[Messenger] Move Transports to separate packages
1 parent 9f93a38 commit 2990c8f

File tree

94 files changed

+3065
-2050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3065
-2050
lines changed

UPGRADE-5.1.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ HttpFoundation
1919
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
2020
`__construct()` instead)
2121

22+
Messenger
23+
---------
24+
25+
* Deprecated AmqpExt transport. It has moved to a separate package. Run `composer require symfony/amqp-messenger` to use the new classes.
26+
* Deprecated Doctrine transport. It has moved to a separate package. Run `composer require symfony/doctrine-messenger` to use the new classes.
27+
* Deprecated RedisExt transport. It has moved to a separate package. Run `composer require symfony/redis-messenger` to use the new classes.
28+
2229
Routing
2330
-------
2431

UPGRADE-6.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ HttpFoundation
1919
`RedirectResponse::create()`, and `StreamedResponse::create()` methods (use
2020
`__construct()` instead)
2121

22+
Messenger
23+
---------
24+
25+
* Removed AmqpExt transport. Run `composer require symfony/amqp-messenger` to keep the transport in your application.
26+
* Removed Doctrine transport. Run `composer require symfony/doctrine-messenger` to keep the transport in your application.
27+
* Removed RedisExt transport. Run `composer require symfony/redis-messenger` to keep the transport in your application.
28+
2229
Routing
2330
-------
2431

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
8282
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
8383
use Symfony\Component\Mailer\Mailer;
84+
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
85+
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory;
8486
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
8587
use Symfony\Component\Messenger\MessageBus;
8688
use Symfony\Component\Messenger\MessageBusInterface;
@@ -312,6 +314,22 @@ public function load(array $configs, ContainerBuilder $container)
312314
$container->removeDefinition('console.command.messenger_failed_messages_show');
313315
$container->removeDefinition('console.command.messenger_failed_messages_remove');
314316
$container->removeDefinition('cache.messenger.restart_workers_signal');
317+
318+
if ($container->hasDefinition('messenger.transport.amqp.factory') && !class_exists(AmqpTransportFactory::class)) {
319+
if (class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class)) {
320+
$container->getDefinition('messenger.transport.amqp.factory')->setClass(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class);
321+
} else {
322+
$container->removeDefinition('messenger.transport.amqp.factory');
323+
}
324+
}
325+
326+
if ($container->hasDefinition('messenger.transport.redis.factory') && !class_exists(RedisTransportFactory::class)) {
327+
if (class_exists(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class)) {
328+
$container->getDefinition('messenger.transport.redis.factory')->setClass(\Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory::class);
329+
} else {
330+
$container->removeDefinition('messenger.transport.redis.factory');
331+
}
332+
}
315333
}
316334

317335
if ($this->httpClientConfigEnabled = $this->isConfigEnabled($container, $config['http_client'])) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/messenger.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
<argument type="tagged_iterator" tag="messenger.transport_factory" />
6868
</service>
6969

70-
<service id="messenger.transport.amqp.factory" class="Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory">
70+
<service id="messenger.transport.amqp.factory" class="Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory">
7171
<tag name="messenger.transport_factory" />
7272
</service>
7373

74-
<service id="messenger.transport.redis.factory" class="Symfony\Component\Messenger\Transport\RedisExt\RedisTransportFactory">
74+
<service id="messenger.transport.redis.factory" class="Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory">
7575
<tag name="messenger.transport_factory" />
7676
</service>
7777

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.gitignore export-ignore
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
5.1.0
5+
-----
6+
7+
* Introduced the AMQP bridge.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018-2020 Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
AMQP Messenger
2+
==============
3+
4+
Provides AMQP integration for Symfony Messenger.
5+
6+
Resources
7+
---------
8+
9+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
10+
* [Report issues](https://github.com/symfony/symfony/issues) and
11+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
12+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Symfony\Component\Messenger\Bridge\Amqp\Tests\Fixtures;
4+
5+
class DummyMessage
6+
{
7+
private $message;
8+
9+
public function __construct(string $message)
10+
{
11+
$this->message = $message;
12+
}
13+
14+
public function getMessage(): string
15+
{
16+
return $this->message;
17+
}
18+
}

0 commit comments

Comments
 (0)