arquivei / laravel-sqs-queue-connector
This package is abandoned and no longer maintained.
No replacement package was suggested.
Consumer queues with different event structures Illuminate pattern
1.0.0
2018-08-21 16:51 UTC
Requires
- php: ^7.1.3
- aws/aws-sdk-php: ^3.0.0
- illuminate/queue: ^5.6
- illuminate/support: ^5.6
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2022-01-06 04:03:00 UTC
README
Consumer queues with different event structures Illuminate pattern
Install
composer require arquivei/laravel-sqs-queue-connector
Add queue config in section connections
in your config/queue.php
'sqs-custom' => [
'driver' => 'sqs-custom',
'key' => env('AWS_KEY', 'your-public-key'),
'secret' => env('AWS_SECRET', 'your-secret-key'),
'prefix' => env('AWS_SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('AWS_EVENTS_QUEUE', 'your-queue-name'),
'region' => env('AWS_REGION', 'us-east-1'),
'consumers' => [
[
'validation' => [
'key' => [],
'value' => '',
],
'job' => YourConsumerJob::class,
],
[
'validation' => [
'key' => [],
'value' => '',
],
'job' => YourConsumerJob::class,
],
],
],
Important
- Your consumers should implement contract interface:
SqsQueueConnector\Queue\Contracts\SqsQueueInterface
Usage
<?php namespace App\Jobs; use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use SqsQueueConnector\Queue\Contracts\SqsQueueInterface; class ConsumerJob implements ShouldQueue, SqsQueueInterface { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; private $data; public function __construct(\stdClass $data) { $this->data = $data; } public function handle() { print_r([ 'data' => $this->data, ]); } }
Run Tests
$ vendor/phpunit/phpunit/phpunit tests
TODO
- Add validation for default consumer
- Add any validation option for one consumer