2017 © Pedro Peláez
 

library laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

image

gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  • Wednesday, April 18, 2018
  • by gustavorglima
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel Json SQS

Dependencies

  • PHP >= 5.5
  • Laravel >= 5.4

Installation

First of all you need to require the package using composer:, (*1)

composer require gustavorglima/laravel-json-sqs

Configuration

Now open config/app.php to add the provider:, (*2)

'providers' => [
    ...
    GustavoLima\JsonSQS\LaravelServiceProvider::class,
];

Publish config/json-sqs.php, (*3)

php artisan vendor:publish --provider="GustavoLima\JsonSQS\LaravelServiceProvider"

Create failed table:, (*4)

php artisan queue:failed-table

Create json-sqs connection on config/queue.php:, (*5)

'json-sqs' => [
    'driver' => 'json-sqs',
    'key' => env('SQS_KEY'),
    'secret' => env('SQS_SECRET'),
    'prefix' => env('SQS_PREFIX'),
    'queue' => env('SQS_QUEUE'),
    'region' => env('SQS_REGION'),
],

Set queue driver on .env, (*6)

QUEUE_DRIVER=json-sqs

And configure your credentials (Example):, (*7)

SQS_KEY=ABCDEFGHIJKLMN
SQS_SECRET=abCDEFghiJKlmNOpqRStuVWXyzabCDEFghiJK
SQS_PREFIX=https://sqs.us-east-1.amazonaws.com/1234567890
SQS_QUEUE=sqs-queue-name
SQS_REGION=us-east-1

Creating a Job

To read published messages on SQS Queue we need to create a Job:, (*8)

php artisan make:job TestJob

You handle method must be like that:, (*9)

public function handle(Job $job, $data)
{
    dd($data); // Just to debug received message
}

Open config/json-sqs.php and add:, (*10)

'test-job' => App\Jobs\TestJob::class,

Publishing a message

To publish a message it's pretty simple, you just need to pass the job name that was specified in config/json-sqs.php and the data, example:, (*11)

dispatch(
    new Dispatcher('test-job', [
        'some' => 'data'
    ])
);

Start the worker

php artisan queue:work json-sqs --tries=3

Obs. In production we recommend to use Supervisor., (*12)

The Versions

18/04 2018

dev-master

9999999-dev https://github.com/gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  Sources   Download

The Requires

 

by Gustavo Lima

laravel json aws sqs

18/04 2018

v1.0.3

1.0.3.0 https://github.com/gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  Sources   Download

The Requires

 

by Gustavo Lima

laravel json aws sqs

28/03 2018

v1.0.2

1.0.2.0 https://github.com/gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  Sources   Download

The Requires

 

by Gustavo Lima

laravel json aws sqs

23/03 2018

v1.0.1

1.0.1.0 https://github.com/gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  Sources   Download

The Requires

 

by Gustavo Lima

laravel json aws sqs

23/03 2018

v1.0.0

1.0.0.0 https://github.com/gustavorglima/laravel-json-sqs

Laravel 5 SQS connector that uses JSON to transmit messages

  Sources   Download

The Requires

 

by Gustavo Lima

laravel json aws sqs