Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CHANGELOG
7.4
---

* Allow SQS to handle it's own retry/DLQ
* Allow SQS to handle its own retry/DLQ
* Add `retry_delay` option to configure the delay between retries when using SQS retry/DLQ handling

7.3
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,28 @@ public function testDoNotDeleteOnRejection()
$expectedParams = [
'QueueUrl' => $queueUrl = 'https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue',
'ReceiptHandle' => $id = 'abc',
'VisibilityTimeout' => $visibilityTimeout = 10,
'VisibilityTimeout' => 0,
];

$client = $this->createMock(SqsClient::class);
$client->expects($this->once())->method('changeMessageVisibility')->with($expectedParams);

$connection = new Connection(['delete_on_rejection' => false, 'visibility_timeout' => $visibilityTimeout], $client, $queueUrl);
$connection = new Connection(['delete_on_rejection' => false, 'visibility_timeout' => 30], $client, $queueUrl);
$connection->reject($id);
}

public function testDoNotDeleteOnRejectionWithRetryDelay()
{
$expectedParams = [
'QueueUrl' => $queueUrl = 'https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue',
'ReceiptHandle' => $id = 'abc',
'VisibilityTimeout' => $retryDelay = 5,
];

$client = $this->createMock(SqsClient::class);
$client->expects($this->once())->method('changeMessageVisibility')->with($expectedParams);

$connection = new Connection(['delete_on_rejection' => false, 'retry_delay' => $retryDelay], $client, $queueUrl);
$connection->reject($id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Connection
'poll_timeout' => 0.1,
'visibility_timeout' => null,
'delete_on_rejection' => true,
'retry_delay' => 0,
'auto_setup' => true,
'access_key' => null,
'secret_key' => null,
Expand Down Expand Up @@ -103,6 +104,7 @@ public function __destruct()
* * poll_timeout: amount of seconds the transport should wait for new message
* * visibility_timeout: amount of seconds the message won't be visible
* * delete_on_rejection: Whether to delete message on rejection or allow SQS to handle retries. (Default: true).
* * retry_delay: amount of seconds the message won't be visible before retry. (Default: 0).
* * sslmode: Can be "disable" to use http for a custom endpoint
* * auto_setup: Whether the queue should be created automatically during send / get (Default: true)
* * debug: Log all HTTP requests and responses as LoggerInterface::DEBUG (Default: false)
Expand Down Expand Up @@ -137,6 +139,7 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
'poll_timeout' => $options['poll_timeout'],
'visibility_timeout' => null !== $options['visibility_timeout'] ? (int) $options['visibility_timeout'] : null,
'delete_on_rejection' => filter_var($options['delete_on_rejection'], \FILTER_VALIDATE_BOOL),
'retry_delay' => (int) $options['retry_delay'],
'auto_setup' => filter_var($options['auto_setup'], \FILTER_VALIDATE_BOOL),
'queue_name' => (string) $options['queue_name'],
'queue_attributes' => $options['queue_attributes'],
Expand Down Expand Up @@ -323,7 +326,7 @@ public function reject(string $id): void
$this->client->changeMessageVisibility([
'QueueUrl' => $this->getQueueUrl(),
'ReceiptHandle' => $id,
'VisibilityTimeout' => $this->configuration['visibility_timeout'] ?? 30,
'VisibilityTimeout' => $this->configuration['retry_delay'],
]);
}
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.