diff --git a/Symfony/sqs/Readme.md b/Symfony/sqs/Readme.md index 6e5e79f..ab8cce5 100644 --- a/Symfony/sqs/Readme.md +++ b/Symfony/sqs/Readme.md @@ -2,8 +2,8 @@ # Pre-requests -Before we start we need to setup the QUEUE. Bref works with both FIFO queues and normal queues. Try to create a new normal -SQS queue, name it "foobar" and click "quick create". +Before we start we need to setup the QUEUE. Bref works with both FIFO queues and standard queues. Try to create a new "standard +queue", name it "foobar" and click "quick create". Example queue ARN: **arn:aws:sqs:us-east-1:403367587399:foobar** Example queue URL: **https://sqs.us-east-1.amazonaws.com/403367587399/foobar** @@ -36,7 +36,7 @@ The last thing we need to do is to allow write access to the queue. 1. Go to IAM in the AWS console 2. Click "Roles" in the left sidebar -3. Find the roles for this Lambda application and click on it. Probably named something like "bref-demo-sqs" +3. Find the roles for this Lambda application and click on it. Probably named something like "bref-demo-sqs-dev-...-LambdaRole" 4. Now click "Attach policy" and find "SQSFullAccess" in the list. After you added that policy you are good to go. You can obviously be more restrictive with what policy to add. diff --git a/Symfony/sqs/bin/consumer.php b/Symfony/sqs/bin/consumer.php index a5696ba..18ea1b5 100644 --- a/Symfony/sqs/bin/consumer.php +++ b/Symfony/sqs/bin/consumer.php @@ -1,6 +1,6 @@ boot(); - $sqsConsumer = $kernel->getContainer()->get(SqsConsumer::class); - $sqsConsumer->consumeLambdaEvent($event); + $worker = $kernel->getContainer()->get(BrefWorker::class); + $worker->consumeLambdaEvent($event); }); \ No newline at end of file diff --git a/Symfony/sqs/composer.json b/Symfony/sqs/composer.json index 0ee0694..1483489 100644 --- a/Symfony/sqs/composer.json +++ b/Symfony/sqs/composer.json @@ -6,7 +6,7 @@ "ext-ctype": "*", "ext-iconv": "*", "bref/bref": "^0.5.12", - "bref/symfony-messenger-sqs": "^0.2.0", + "bref/symfony-messenger": "dev-master", "symfony/console": "4.4.*", "symfony/flex": "^1.3.1", "symfony/framework-bundle": "4.4.*", diff --git a/Symfony/sqs/composer.lock b/Symfony/sqs/composer.lock index e94c6e6..b142e84 100644 --- a/Symfony/sqs/composer.lock +++ b/Symfony/sqs/composer.lock @@ -4,30 +4,30 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b52d303c3743c08e8dac42ab67d26df", + "content-hash": "36bb888ce07aa7746cd42812cbe4f072", "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.130.3", + "version": "3.133.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "916356edb5c30fa564d02de94bde51a9c0bb4469" + "reference": "49ee9aad9b7918feb5a0eab79e0f7c08a9696fe0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/916356edb5c30fa564d02de94bde51a9c0bb4469", - "reference": "916356edb5c30fa564d02de94bde51a9c0bb4469", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/49ee9aad9b7918feb5a0eab79e0f7c08a9696fe0", + "reference": "49ee9aad9b7918feb5a0eab79e0f7c08a9696fe0", "shasum": "" }, "require": { "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", - "guzzlehttp/guzzle": "^5.3.3|^6.2.1", - "guzzlehttp/promises": "~1.0", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", + "guzzlehttp/promises": "^1.0", "guzzlehttp/psr7": "^1.4.1", - "mtdowling/jmespath.php": "~2.2", + "mtdowling/jmespath.php": "^2.5", "php": ">=5.5" }, "require-dev": { @@ -88,20 +88,20 @@ "s3", "sdk" ], - "time": "2020-01-02T19:13:50+00:00" + "time": "2020-01-17T19:15:02+00:00" }, { "name": "bref/bref", - "version": "0.5.12", + "version": "0.5.13", "source": { "type": "git", "url": "https://github.com/brefphp/bref.git", - "reference": "be2d60d4989d82f5cbe502b6c39e6ba00a626056" + "reference": "630ce0ff91117134546c5c5f22c59b5ed3aed556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brefphp/bref/zipball/be2d60d4989d82f5cbe502b6c39e6ba00a626056", - "reference": "be2d60d4989d82f5cbe502b6c39e6ba00a626056", + "url": "https://api.github.com/repos/brefphp/bref/zipball/630ce0ff91117134546c5c5f22c59b5ed3aed556", + "reference": "630ce0ff91117134546c5c5f22c59b5ed3aed556", "shasum": "" }, "require": { @@ -147,42 +147,44 @@ "lambda", "serverless" ], - "time": "2019-12-18T13:21:05+00:00" + "time": "2020-01-13T06:36:17+00:00" }, { - "name": "bref/symfony-messenger-sqs", - "version": "0.2.0", + "name": "bref/symfony-messenger", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/brefphp/symfony-messenger-sqs.git", - "reference": "85918eff602e1fe0de35714d661469e283033b84" + "url": "https://github.com/brefphp/symfony-messenger.git", + "reference": "f17dffb2a61e0ce470533afd05faac17bbb95fb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brefphp/symfony-messenger-sqs/zipball/85918eff602e1fe0de35714d661469e283033b84", - "reference": "85918eff602e1fe0de35714d661469e283033b84", + "url": "https://api.github.com/repos/brefphp/symfony-messenger/zipball/f17dffb2a61e0ce470533afd05faac17bbb95fb6", + "reference": "f17dffb2a61e0ce470533afd05faac17bbb95fb6", "shasum": "" }, "require": { "aws/aws-sdk-php": "^3.127", "ext-json": "*", "php": "^7.3", - "symfony/config": "^4.3|^5.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/http-kernel": "^4.3|^5.0", - "symfony/messenger": "^4.3|^5.0", - "symfony/yaml": "^4.3|^5.0" + "symfony/config": "^4.3 || ^5.0", + "symfony/dependency-injection": "^4.3 || ^5.0", + "symfony/http-kernel": "^4.3 || ^5.0", + "symfony/messenger": "^4.3 || ^5.0", + "symfony/yaml": "^4.3 || ^5.0" }, "require-dev": { + "matthiasnoback/symfony-dependency-injection-test": "^4.1", "mnapoli/hard-mode": "^0.2.0", + "nyholm/symfony-bundle-test": "^1.6", "phpstan/phpstan": "^0.12.0", - "phpunit/phpunit": "^8.0", - "symfony/framework-bundle": "^4.3|^5.0" + "phpunit/phpunit": "^8.5", + "symfony/framework-bundle": "^4.3 || ^5.0" }, "type": "library", "autoload": { "psr-4": { - "Bref\\Messenger\\": "src/" + "Bref\\Symfony\\Messenger\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -192,13 +194,15 @@ "description": "Symfony Messenger bridge to run with SQS on AWS Lambda with Bref", "keywords": [ "Messenger", + "SNS", "aws", "aws-lambda", "bref", + "s3", "sqs", "symfony" ], - "time": "2019-12-05T11:06:37+00:00" + "time": "2020-01-19T19:29:00+00:00" }, { "name": "guzzlehttp/guzzle", @@ -2653,7 +2657,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "bref/symfony-messenger": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/Symfony/sqs/config/bundles.php b/Symfony/sqs/config/bundles.php index bb469fd..56b3c52 100644 --- a/Symfony/sqs/config/bundles.php +++ b/Symfony/sqs/config/bundles.php @@ -2,5 +2,5 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Bref\Messenger\BrefMessengerBundle::class => ['all' => true], + Bref\Symfony\Messenger\BrefMessengerBundle::class => ['all' => true], ]; diff --git a/Symfony/sqs/config/packages/messenger.yaml b/Symfony/sqs/config/packages/messenger.yaml index 426d559..062cdee 100644 --- a/Symfony/sqs/config/packages/messenger.yaml +++ b/Symfony/sqs/config/packages/messenger.yaml @@ -9,12 +9,17 @@ framework: routing: 'App\Message\Ping': async +bref_messenger: + sqs: true # Register the SQS transport + services: - Bref\Messenger\Sqs\SqsConsumer: - autowire: true - autoconfigure: true + my_sqs_consumer: + class: Bref\Symfony\Messenger\Service\Sqs\SqsConsumer arguments: - # Inject the transport name used in config/packages/messenger.yaml - $transportName: 'async' - public: true + - '@Bref\Symfony\Messenger\Service\BusDriver' + - '@messenger.routable_message_bus' + - '@Symfony\Component\Messenger\Transport\Serialization\SerializerInterface' + - 'async' # Same as transport name + tags: + - { name: bref_messenger.consumer } \ No newline at end of file diff --git a/Symfony/sqs/symfony.lock b/Symfony/sqs/symfony.lock index 6b4c674..67d3751 100644 --- a/Symfony/sqs/symfony.lock +++ b/Symfony/sqs/symfony.lock @@ -5,6 +5,9 @@ "bref/bref": { "version": "0.5.12" }, + "bref/symfony-messenger": { + "version": "dev-master" + }, "bref/symfony-messenger-sqs": { "version": "0.2.0" },