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

[Messenger] [AmazonSqs] Allow async-aws/sqs version 2 #53524

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

Merged
merged 1 commit into from
Jan 23, 2024
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
8 changes: 4 additions & 4 deletions 8 .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ jobs:
- 8094:8094
- 11210:11210
sqs:
image: asyncaws/testing-sqs
image: localstack/localstack:3.0.2
ports:
- 9494:9494
- 4566:4566
zookeeper:
image: wurstmeister/zookeeper:3.4.6
kafka:
Expand Down Expand Up @@ -184,8 +184,8 @@ jobs:
REDIS_SENTINEL_SERVICE: redis_sentinel
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
MESSENGER_SQS_DSN: "sqs://localhost:9494/messages?sslmode=disable&poll_timeout=0.01"
MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:9494/messages.fifo?sslmode=disable&poll_timeout=0.01"
MESSENGER_SQS_DSN: "sqs://localhost:4566/messages?sslmode=disable&poll_timeout=0.01"
MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:4566/messages.fifo?sslmode=disable&poll_timeout=0.01"
KAFKA_BROKER: 127.0.0.1:9092
POSTGRES_HOST: localhost

Expand Down
2 changes: 1 addition & 1 deletion 2 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"amphp/http-client": "^4.2.1",
"amphp/http-tunnel": "^1.0",
"async-aws/ses": "^1.0",
"async-aws/sqs": "^1.0",
"async-aws/sqs": "^1.0|^2.0",
"async-aws/sns": "^1.0",
"cache/integration-tests": "dev-master",
"doctrine/annotations": "^1.13.1|^2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use AsyncAws\Sqs\Result\ReceiveMessageResult;
use AsyncAws\Sqs\SqsClient;
use AsyncAws\Sqs\ValueObject\Message;
use Composer\InstalledVersions;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;
Expand Down Expand Up @@ -342,6 +343,16 @@ public function testLoggerWithDebugOption()

private function getMockedQueueUrlResponse(): MockResponse
{
if ($this->isAsyncAwsSqsVersion2Installed()) {
return new MockResponse(
<<<JSON
{
"QueueUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue"
}
JSON
);
}

return new MockResponse(<<<XML
<GetQueueUrlResponse>
<GetQueueUrlResult>
Expand All @@ -357,6 +368,28 @@ private function getMockedQueueUrlResponse(): MockResponse

private function getMockedReceiveMessageResponse(): MockResponse
{
if ($this->isAsyncAwsSqsVersion2Installed()) {
return new MockResponse(<<<JSON
{
"Messages": [
{
"Attributes": {
"SenderId": "195004372649",
"ApproximateFirstReceiveTimestamp": "1250700979248",
"ApproximateReceiveCount": "5",
"SentTimestamp": "1238099229000"
},
"Body": "This is a test message",
"MD5OfBody": "fafb00f5732ab283681e124bf8747ed1",
"MessageId": "5fea7756-0ea4-451a-a703-a558b933e274",
"ReceiptHandle": "MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+CwLj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QEauMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0="
}
]
}
JSON
);
}

return new MockResponse(<<<XML
<ReceiveMessageResponse>
<ReceiveMessageResult>
Expand Down Expand Up @@ -394,4 +427,11 @@ private function getMockedReceiveMessageResponse(): MockResponse
XML
);
}

private function isAsyncAwsSqsVersion2Installed(): bool
{
$version = InstalledVersions::getVersion('async-aws/sqs');

return 'dev-master' === $version || version_compare($version, '2.0.0') >= 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=7.2.5",
"async-aws/core": "^1.5",
"async-aws/sqs": "^1.0",
"async-aws/sqs": "^1.0|^2.0",
"symfony/messenger": "^4.3|^5.0|^6.0",
"symfony/service-contracts": "^1.1|^2|^3",
"psr/log": "^1|^2|^3"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.