Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use strings for 'VisibilityTimeout' #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SqsConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion SqsDestination.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/SqsConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function testShouldRejectMessageAndRequeue()
'@region' => 'theRegion',
'QueueUrl' => 'theQueueUrl',
'ReceiptHandle' => 'theReceipt',
'VisibilityTimeout' => 0,
'VisibilityTimeout' => '0',
]))
;

Expand Down Expand Up @@ -248,7 +248,7 @@ public function testShouldRejectMessageAndRequeueWithVisibilityTimeout()
'@region' => 'theRegion',
'QueueUrl' => 'theQueueUrl',
'ReceiptHandle' => 'theReceipt',
'VisibilityTimeout' => 30,
'VisibilityTimeout' => '30',
]))
;

Expand Down
2 changes: 1 addition & 1 deletion Tests/SqsDestinationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down