@@ -97,7 +97,7 @@ public function testShouldConvertTransportMessageToClientMessage()
9797 $transportMessage->setBody('body');
9898 $transportMessage->setHeaders(['hkey' => 'hval']);
9999 $transportMessage->setProperties(['key' => 'val']);
100- $transportMessage->setProperty('x -delay', '5678000');
100+ $transportMessage->setProperty('enqueue -delay', '5678000');
101101 $transportMessage->setHeader('content_type', 'ContentType');
102102 $transportMessage->setHeader('expiration', '12345000');
103103 $transportMessage->setHeader('priority', 3);
@@ -108,7 +108,7 @@ public function testShouldConvertTransportMessageToClientMessage()
108108
109109 $driver = new RabbitMqDriver(
110110 $this->createAmqpContextMock(),
111- new Config('', '', '', '', '', '', ['delay_plugin_installed ' => true ]),
111+ new Config('', '', '', '', '', '', ['delay_strategy ' => 'dlx' ]),
112112 $this->createDummyQueueMetaRegistry()
113113 );
114114
@@ -128,7 +128,7 @@ public function testShouldConvertTransportMessageToClientMessage()
128128 ], $clientMessage->getHeaders());
129129 $this->assertSame([
130130 'key' => 'val',
131- 'x -delay' => '5678000',
131+ 'enqueue -delay' => '5678000',
132132 ], $clientMessage->getProperties());
133133 $this->assertSame('MessageId', $clientMessage->getMessageId());
134134 $this->assertSame(12345, $clientMessage->getExpire());
@@ -143,7 +143,7 @@ public function testShouldConvertTransportMessageToClientMessage()
143143 public function testShouldThrowExceptionIfXDelayIsNotNumeric()
144144 {
145145 $transportMessage = new AmqpMessage();
146- $transportMessage->setProperty('x -delay', 'is-not-numeric');
146+ $transportMessage->setProperty('enqueue -delay', 'is-not-numeric');
147147
148148 $driver = new RabbitMqDriver(
149149 $this->createAmqpContextMock(),
@@ -152,7 +152,7 @@ public function testShouldThrowExceptionIfXDelayIsNotNumeric()
152152 );
153153
154154 $this->expectException(\LogicException::class);
155- $this->expectExceptionMessage('x -delay header is not numeric. "is-not-numeric"');
155+ $this->expectExceptionMessage('"enqueue -delay" header is not numeric. "is-not-numeric"');
156156
157157 $driver->createClientMessage($transportMessage);
158158 }
@@ -239,7 +239,7 @@ public function testShouldConvertClientMessageToTransportMessage()
239239
240240 $driver = new RabbitMqDriver(
241241 $context,
242- new Config('', '', '', '', '', '', ['delay_plugin_installed ' => true ]),
242+ new Config('', '', '', '', '', '', ['delay_strategy ' => 'dlx' ]),
243243 $this->createDummyQueueMetaRegistry()
244244 );
245245
@@ -260,7 +260,7 @@ public function testShouldConvertClientMessageToTransportMessage()
260260 ], $transportMessage->getHeaders());
261261 $this->assertSame([
262262 'key' => 'val',
263- 'x -delay' => ' 432000' ,
263+ 'enqueue -delay' => 432000,
264264 ], $transportMessage->getProperties());
265265 $this->assertSame('MessageId', $transportMessage->getMessageId());
266266 $this->assertSame(1000, $transportMessage->getTimestamp());
@@ -282,12 +282,12 @@ public function testThrowIfDelayNotSupportedOnConvertClientMessageToTransportMes
282282
283283 $driver = new RabbitMqDriver(
284284 $context,
285- new Config('', '', '', '', '', '', ['delay_plugin_installed ' => false ]),
285+ new Config('', '', '', '', '', '', ['delay_strategy ' => null ]),
286286 $this->createDummyQueueMetaRegistry()
287287 );
288288
289289 $this->expectException(\LogicException::class);
290- $this->expectExceptionMessage('The message delaying is not supported. In order to use delay feature install RabbitMQ delay plugin .');
290+ $this->expectExceptionMessage('The message delaying is not supported. In order to use delay feature install RabbitMQ delay strategy .');
291291 $driver->createTransportMessage($clientMessage);
292292 }
293293
@@ -386,29 +386,28 @@ public function testShouldSendMessageToProcessor()
386386 $driver->sendToProcessor($message);
387387 }
388388
389- public function testShouldSendMessageToDelayExchangeIfDelaySet ()
389+ public function testShouldSendMessageToProcessorWithDeliveryDelay ()
390390 {
391391 $queue = new AmqpQueue('');
392- $delayTopic = new AmqpTopic('');
393392 $transportMessage = new AmqpMessage();
394393
395394 $producer = $this->createAmqpProducerMock();
396395 $producer
397396 ->expects($this->once())
398397 ->method('send')
399- ->with($this->identicalTo($delayTopic), $this->identicalTo($transportMessage))
398+ ->with($this->identicalTo($queue), $this->identicalTo($transportMessage))
399+ ;
400+ $producer
401+ ->expects($this->once())
402+ ->method('setDeliveryDelay')
403+ ->with($this->identicalTo(10000))
400404 ;
401405 $context = $this->createAmqpContextMock();
402406 $context
403407 ->expects($this->once())
404408 ->method('createQueue')
405409 ->willReturn($queue)
406410 ;
407- $context
408- ->expects($this->once())
409- ->method('createTopic')
410- ->willReturn($delayTopic)
411- ;
412411 $context
413412 ->expects($this->once())
414413 ->method('createProducer')
@@ -422,7 +421,7 @@ public function testShouldSendMessageToDelayExchangeIfDelaySet()
422421
423422 $driver = new RabbitMqDriver(
424423 $context,
425- new Config('', '', '', '', '', '', ['delay_plugin_installed ' => true ]),
424+ new Config('', '', '', '', '', '', ['delay_strategy ' => 'dlx' ]),
426425 $this->createDummyQueueMetaRegistry()
427426 );
428427
@@ -521,7 +520,6 @@ public function testShouldSetupBroker()
521520 $routerQueue = new AmqpQueue('');
522521
523522 $processorQueue = new AmqpQueue('');
524- $delayTopic = new AmqpTopic('');
525523
526524 $context = $this->createAmqpContextMock();
527525 // setup router
@@ -561,27 +559,6 @@ public function testShouldSetupBroker()
561559 ->method('declareQueue')
562560 ->with($this->identicalTo($processorQueue))
563561 ;
564- $context
565- ->expects($this->at(7))
566- ->method('createQueue')
567- ->willReturn($processorQueue)
568- ;
569- $context
570- ->expects($this->at(8))
571- ->method('createTopic')
572- ->willReturn($delayTopic)
573- ;
574- $context
575- ->expects($this->at(9))
576- ->method('declareTopic')
577- ->with($this->identicalTo($delayTopic))
578- ;
579-
580- $context
581- ->expects($this->at(10))
582- ->method('bind')
583- ->with($this->isInstanceOf(AmqpBind::class))
584- ;
585562
586563 $config = Config::create('', '', '', '', '', '', ['delay_plugin_installed' => true]);
587564
0 commit comments