Skip to content

Commit efd269f

Browse files
committed
[client] fix simple client tests
1 parent f1ff387 commit efd269f

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

‎pkg/simple-client/SimpleClient.php‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
namespace Enqueue\SimpleClient;
44

5-
use Enqueue\AmqpExt\Symfony\AmqpTransportFactory;
6-
use Enqueue\AmqpExt\Symfony\RabbitMqAmqpTransportFactory;
5+
use Enqueue\AmqpBunny\AmqpConnectionFactory as AmqpBunnyConnectionFactory;
6+
use Enqueue\AmqpExt\AmqpConnectionFactory as AmqpExtConnectionFactory;
7+
use Enqueue\AmqpLib\AmqpConnectionFactory as AmqpLibConnectionFactory;
78
use Enqueue\Client\ArrayProcessorRegistry;
89
use Enqueue\Client\Config;
910
use Enqueue\Client\DelegateProcessor;
@@ -22,7 +23,9 @@
2223
use Enqueue\Sqs\Symfony\SqsTransportFactory;
2324
use Enqueue\Stomp\Symfony\RabbitMqStompTransportFactory;
2425
use Enqueue\Stomp\Symfony\StompTransportFactory;
26+
use Enqueue\Symfony\AmqpTransportFactory;
2527
use Enqueue\Symfony\DefaultTransportFactory;
28+
use Enqueue\Symfony\RabbitMqAmqpTransportFactory;
2629
use Interop\Queue\PsrContext;
2730
use Interop\Queue\PsrProcessor;
2831
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -46,17 +49,17 @@ final class SimpleClient
4649
*
4750
*$config = [
4851
* 'transport' => [
49-
* 'default' => 'amqp',
50-
* 'amqp' => [], // amqp options here
52+
* 'default' => 'amqp_ext',
53+
* 'amqp_ext' => [], // amqp options here
5154
* ],
5255
* ]
5356
*
5457
* or a with all details:
5558
*
5659
* $config = [
5760
* 'transport' => [
58-
* 'default' => 'amqp',
59-
* 'amqp' => [],
61+
* 'default' => 'amqp_ext',
62+
* 'amqp_ext' => [],
6063
* ....
6164
* ],
6265
* 'client' => [
@@ -275,8 +278,6 @@ private function buildContainerExtension()
275278
{
276279
$map = [
277280
'default' => DefaultTransportFactory::class,
278-
'amqp' => AmqpTransportFactory::class,
279-
'rabbitmq_amqp' => RabbitMqAmqpTransportFactory::class,
280281
'dbal' => DbalTransportFactory::class,
281282
'fs' => FsTransportFactory::class,
282283
'redis' => RedisTransportFactory::class,
@@ -293,6 +294,21 @@ private function buildContainerExtension()
293294
}
294295
}
295296

297+
if (class_exists(AmqpExtConnectionFactory::class)) {
298+
$extension->addTransportFactory(new AmqpTransportFactory(AmqpExtConnectionFactory::class, 'amqp_ext'));
299+
$extension->addTransportFactory(new RabbitMqAmqpTransportFactory(AmqpExtConnectionFactory::class, 'rabbitmq_amqp_ext'));
300+
}
301+
302+
if (class_exists(AmqpLibConnectionFactory::class)) {
303+
$extension->addTransportFactory(new AmqpTransportFactory(AmqpLibConnectionFactory::class, 'amqp_lib'));
304+
$extension->addTransportFactory(new RabbitMqAmqpTransportFactory(AmqpLibConnectionFactory::class, 'rabbitmq_amqp_lib'));
305+
}
306+
307+
if (class_exists(AmqpBunnyConnectionFactory::class)) {
308+
$extension->addTransportFactory(new AmqpTransportFactory(AmqpBunnyConnectionFactory::class, 'amqp_bunny'));
309+
$extension->addTransportFactory(new RabbitMqAmqpTransportFactory(AmqpBunnyConnectionFactory::class, 'rabbitmq_amqp_bunny'));
310+
}
311+
296312
return $extension;
297313
}
298314

‎pkg/simple-client/Tests/Functional/SimpleClientTest.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function transportConfigDataProvider()
3333
{
3434
yield 'amqp' => [[
3535
'transport' => [
36-
'default' => 'amqp',
37-
'amqp' => [
36+
'default' => 'amqp_ext',
37+
'amqp_ext' => [
3838
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
3939
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
4040
'user' => getenv('SYMFONY__RABBITMQ__USER'),
@@ -48,8 +48,8 @@ public function transportConfigDataProvider()
4848

4949
yield 'amqp_dsn' => [[
5050
'transport' => [
51-
'default' => 'amqp',
52-
'amqp' => getenv('AMQP_DSN'),
51+
'default' => 'amqp_ext',
52+
'amqp_ext' => getenv('AMQP_DSN'),
5353
],
5454
]];
5555

@@ -61,8 +61,8 @@ public function transportConfigDataProvider()
6161

6262
yield [[
6363
'transport' => [
64-
'default' => 'rabbitmq_amqp',
65-
'rabbitmq_amqp' => [
64+
'default' => 'rabbitmq_amqp_ext',
65+
'rabbitmq_amqp_ext' => [
6666
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
6767
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
6868
'user' => getenv('SYMFONY__RABBITMQ__USER'),

0 commit comments

Comments
 (0)