Skip to content
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
5 changes: 5 additions & 0 deletions src/Symfony/Component/Messenger/Bridge/AmazonSqs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

5.2.0
-----

* Added support for an Amazon SQS QueueUrl to be used as DSN.

5.1.0
-----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function testSupportsOnlySqsTransports()
$factory = new AmazonSqsTransportFactory();

$this->assertTrue($factory->supports('sqs://localhost', []));
$this->assertTrue($factory->supports('https://sqs.us-east-2.amazonaws.com/123456789012/ab1-MyQueue-A2BCDEF3GHI4', []));
$this->assertFalse($factory->supports('redis://localhost', []));
$this->assertFalse($factory->supports('invalid-dsn', []));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public function testFromDsnWithRegion()
);
}

public function testFromDsnAsQueueUrl()
{
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
$this->assertEquals(
new Connection(['queue_name' => 'ab1-MyQueue-A2BCDEF3GHI4', 'account' => '123456789012'], new SqsClient(['region' => 'us-east-2', 'endpoint' => 'https://sqs.us-east-2.amazonaws.com', 'accessKeyId' => null, 'accessKeySecret' => null], null, $httpClient)),
Connection::fromDsn('https://sqs.us-east-2.amazonaws.com/123456789012/ab1-MyQueue-A2BCDEF3GHI4', [], $httpClient)
);
}

public function testFromDsnWithCustomEndpoint()
{
$httpClient = $this->getMockBuilder(HttpClientInterface::class)->getMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function createTransport(string $dsn, array $options, SerializerInterface

public function supports(string $dsn, array $options): bool
{
return 0 === strpos($dsn, 'sqs://');
return 0 === strpos($dsn, 'sqs://') || preg_match('#^https://sqs\.[\w\-]+\.amazonaws\.com/.+#', $dsn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function createTransport(string $dsn, array $options, SerializerInterface
$packageSuggestion = ' Run "composer require symfony/doctrine-messenger" to install Doctrine transport.';
} elseif (0 === strpos($dsn, 'redis://')) {
$packageSuggestion = ' Run "composer require symfony/redis-messenger" to install Redis transport.';
} elseif (0 === strpos($dsn, 'sqs://')) {
} elseif (0 === strpos($dsn, 'sqs://') || preg_match('#^https://sqs\.[\w\-]+\.amazonaws\.com/.+#', $dsn)) {
$packageSuggestion = ' Run "composer require symfony/amazon-sqs-messenger" to install Amazon SQS transport.';
}

Expand Down