Skip to content

Commit c9b7822

Browse files
committed
delay strategy
1 parent 5ae3d14 commit c9b7822

5 files changed

Lines changed: 138 additions & 2 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpBunny\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpTools\RabbitMQDelayPluginDelayStrategy;
7+
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
9+
10+
class SendAndReceiveDelayedMessageWithDelayPluginStrategyTest extends SendAndReceiveDelayedMessageFromQueueSpec
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
protected function createContext()
16+
{
17+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
18+
$factory->setDelayStrategy(new RabbitMQDelayPluginDelayStrategy());
19+
20+
return $factory->createContext();
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
protected function createQueue(PsrContext $context, $queueName)
27+
{
28+
$queue = parent::createQueue($context, $queueName);
29+
30+
$context->declareQueue($queue);
31+
32+
return $queue;
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpBunny\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
7+
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
9+
10+
class SendAndReceiveDelayedMessageWithDlxStrategyTest extends SendAndReceiveDelayedMessageFromQueueSpec
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
protected function createContext()
16+
{
17+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
18+
$factory->setDelayStrategy(new RabbitMqDlxDelayStrategy());
19+
20+
return $factory->createContext();
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
protected function createQueue(PsrContext $context, $queueName)
27+
{
28+
$queue = parent::createQueue($context, $queueName);
29+
30+
$context->declareQueue($queue);
31+
32+
return $queue;
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpExt\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpTools\RabbitMQDelayPluginDelayStrategy;
7+
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
9+
10+
class SendAndReceiveDelayedMessageWithDelayPluginStrategyTest extends SendAndReceiveDelayedMessageFromQueueSpec
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
protected function createContext()
16+
{
17+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
18+
$factory->setDelayStrategy(new RabbitMQDelayPluginDelayStrategy());
19+
20+
return $factory->createContext();
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
protected function createQueue(PsrContext $context, $queueName)
27+
{
28+
$queue = parent::createQueue($context, $queueName);
29+
30+
$context->declareQueue($queue);
31+
32+
return $queue;
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpExt\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
7+
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
9+
10+
class SendAndReceiveDelayedMessageWithDlxStrategyTest extends SendAndReceiveDelayedMessageFromQueueSpec
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
protected function createContext()
16+
{
17+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
18+
$factory->setDelayStrategy(new RabbitMqDlxDelayStrategy());
19+
20+
return $factory->createContext();
21+
}
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
protected function createQueue(PsrContext $context, $queueName)
27+
{
28+
$queue = parent::createQueue($context, $queueName);
29+
30+
$context->declareQueue($queue);
31+
32+
return $queue;
33+
}
34+
}

‎pkg/amqp-lib/Tests/Spec/SendAndReceiveDelayedMessageWithDelayPluginStrategyTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Enqueue\AmqpLib\Tests\Spec;
44

55
use Enqueue\AmqpLib\AmqpConnectionFactory;
6-
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
6+
use Enqueue\AmqpTools\RabbitMQDelayPluginDelayStrategy;
77
use Interop\Queue\PsrContext;
88
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
99

@@ -15,7 +15,7 @@ class SendAndReceiveDelayedMessageWithDelayPluginStrategyTest extends SendAndRec
1515
protected function createContext()
1616
{
1717
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
18-
$factory->setDelayStrategy(new RabbitMqDlxDelayStrategy());
18+
$factory->setDelayStrategy(new RabbitMQDelayPluginDelayStrategy());
1919

2020
return $factory->createContext();
2121
}

0 commit comments

Comments
 (0)