diff --git a/pkg/amqp-tools/RabbitMqDelayPluginDelayStrategy.php b/pkg/amqp-tools/RabbitMqDelayPluginDelayStrategy.php index 192135965..a15063ed9 100644 --- a/pkg/amqp-tools/RabbitMqDelayPluginDelayStrategy.php +++ b/pkg/amqp-tools/RabbitMqDelayPluginDelayStrategy.php @@ -17,7 +17,8 @@ class RabbitMqDelayPluginDelayStrategy implements DelayStrategy public function delayMessage(AmqpContext $context, AmqpDestination $dest, AmqpMessage $message, int $delay): void { $delayMessage = $context->createMessage($message->getBody(), $message->getProperties(), $message->getHeaders()); - $delayMessage->setProperty('x-delay', (int) $delay); + $delayMessage->setProperty('x-delay', $delay); + $delayMessage->setHeader('x-delay', $delay); $delayMessage->setRoutingKey($message->getRoutingKey()); if ($dest instanceof AmqpTopic) { diff --git a/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php b/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php index 17a8b2a5f..c6028f99d 100644 --- a/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php +++ b/pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php @@ -84,6 +84,8 @@ public function testShouldSendDelayedMessageToTopic() ], $delayedTopic->getArguments()); $this->assertSame(['x-delay' => 10000], $delayedMessage->getProperties()); + $this->assertArrayHasKey('x-delay', $delayedMessage->getHeaders()); + $this->assertSame(10000, $delayedMessage->getHeaders()['x-delay']); $this->assertSame('the-routing-key', $delayedMessage->getRoutingKey()); }