diff --git a/SqsConsumer.php b/SqsConsumer.php index 04d5bbd..86e28f6 100644 --- a/SqsConsumer.php +++ b/SqsConsumer.php @@ -138,7 +138,7 @@ public function reject(Message $message, bool $requeue = false): void '@region' => $this->queue->getRegion(), 'QueueUrl' => $this->context->getQueueUrl($this->queue), 'ReceiptHandle' => $message->getReceiptHandle(), - 'VisibilityTimeout' => $message->getRequeueVisibilityTimeout(), + 'VisibilityTimeout' => (string) $message->getRequeueVisibilityTimeout(), ]); } else { $this->context->getSqsClient()->deleteMessage([ @@ -165,7 +165,7 @@ protected function receiveMessage(int $timeoutSeconds): ?SqsMessage ]; if ($this->visibilityTimeout) { - $arguments['VisibilityTimeout'] = $this->visibilityTimeout; + $arguments['VisibilityTimeout'] = (string) $this->visibilityTimeout; } $result = $this->context->getSqsClient()->receiveMessage($arguments); diff --git a/SqsDestination.php b/SqsDestination.php index 5649d30..bdad9f8 100644 --- a/SqsDestination.php +++ b/SqsDestination.php @@ -150,7 +150,7 @@ public function setVisibilityTimeout(int $seconds = null): void if (null == $seconds) { unset($this->attributes['VisibilityTimeout']); } else { - $this->attributes['VisibilityTimeout'] = $seconds; + $this->attributes['VisibilityTimeout'] = (string) $seconds; } } diff --git a/Tests/SqsConsumerTest.php b/Tests/SqsConsumerTest.php index 05fbb9b..b28a64e 100644 --- a/Tests/SqsConsumerTest.php +++ b/Tests/SqsConsumerTest.php @@ -208,7 +208,7 @@ public function testShouldRejectMessageAndRequeue() '@region' => 'theRegion', 'QueueUrl' => 'theQueueUrl', 'ReceiptHandle' => 'theReceipt', - 'VisibilityTimeout' => 0, + 'VisibilityTimeout' => '0', ])) ; @@ -248,7 +248,7 @@ public function testShouldRejectMessageAndRequeueWithVisibilityTimeout() '@region' => 'theRegion', 'QueueUrl' => 'theQueueUrl', 'ReceiptHandle' => 'theReceipt', - 'VisibilityTimeout' => 30, + 'VisibilityTimeout' => '30', ])) ; diff --git a/Tests/SqsDestinationTest.php b/Tests/SqsDestinationTest.php index 724ce0c..a0a613e 100644 --- a/Tests/SqsDestinationTest.php +++ b/Tests/SqsDestinationTest.php @@ -79,7 +79,7 @@ public function testCouldSetVisibilityTimeoutAttribute() $destination = new SqsDestination('aDestinationName'); $destination->setVisibilityTimeout(12345); - $this->assertSame(['VisibilityTimeout' => 12345], $destination->getAttributes()); + $this->assertSame(['VisibilityTimeout' => '12345'], $destination->getAttributes()); } public function testCouldSetFifoQueueAttributeAndUnsetIt()