Download the PHP package maxgaurav/laravel-sns-sqs-queue without Composer
On this page you can find all versions of the php package maxgaurav/laravel-sns-sqs-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-sns-sqs-queue
Process SNS Messages as SQS Jobs
This package allows you to process sns messages posted on various topics subscribed by an SQS to be processed as a job.
The queue also processes standard jobs pushed via laravel.
This package is a great use cases for applications beings deployed to microservices.
Requirements
- PHP >= 7.2
- Laravel 6
- SQS driver for laravel
- SQS in AWS
- SNS in AWS
Installation
Install using composer
The package will automatically register its service provider.
Configuration
In queue.php add the following driver setup
Prerequisites
- First setup your SQS queue in AWS
- The SQS must be subscribed to all the topics of SNS you want to process through your job.
Usage
Each job created must have two constructor inputs. First input is for the topic name the job is executing for and second is the array of json decoded data sent in the message.
Default Job
The package uses a default job instance \MaxGaurav\LaravelSnsSqsQueue\DefaultJob for topics not mapped in the configuration. The job has a default functionality to fail for such topics. This is done to allow the application to tell that topics are not mapped.
The DefaultJob class can be replaced with a custom default job handler using key default-job. Pass your class instance and it would be used instead.
Normal Jobs
The package can also be used to push normal jobs to SQS queue as done using sqs driver. The queue would check if the job is a sns job then would map to topic name and would call the mapped jobs otherwise would fallback to default SQS driver behavior.
All versions of laravel-sns-sqs-queue with dependencies
illuminate/queue Version 6.* || 7.*
aws/aws-sdk-php Version ^3.62
ext-json Version *