2017 © Pedro Peláez
 

library laravel-sns-subscription-queues

A Laravel package that allows the queueing system to deal with the non-laravel payload when subscribed to an AWS SNS topic.

image

kirschbaum/laravel-sns-subscription-queues

A Laravel package that allows the queueing system to deal with the non-laravel payload when subscribed to an AWS SNS topic.

  • Friday, June 10, 2016
  • by Kirschbaum
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,376 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Laravel SNS Subscription Queues

Under Active Development

This package is actively being developed and should be considered experimental for the time being., (*2)

Laravel Version Support

Due to some changes that were made in Laravel version 5.1.20 this package currently only supports version 5.1.20 and higher. It does not support v5.2.0 or higher at this time., (*3)

Usage

This package extends the default Illuminate\Queue\QueueServiceProvider to handle queue payloads from SNS Topic subscriptions. It works by checking for a custom handler configuration in the event the Job doesn't meet the expected Laravel payload structure. If a custom queue handler has been configured this package then adds the necessary structure so that the queue system can process the Job., (*4)

Installation

Add the package to your project:, (*5)

For now update your composer.json, (*6)

    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"

then, (*7)

composer require kirschbaum/laravel-sns-subscription-queues

Add the following service provider:, (*8)

// config/app.php

'providers' => [
    ...
    Kirschbaum\LaravelSnsSubscriptionQueues\ServiceProvider::class,
    ...
];

Publish the config file using the Artisan command:, (*9)

php artisan vendor:publish --provider="Kirschbaum\LaravelSnsSubscriptionQueues\ServiceProvider"

The configuration looks like this:, (*10)

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Custom Handlers for SNS Subscription Queues
    |--------------------------------------------------------------------------
    |
    | Here is where we map an ARN Topic to the Laravel Job handler that should
    | process the queue payload.
    |
    */

    // Examples
    'arn:aws:sns:us-east-1:012345667910:my-sns-topic-name' => 'App\\Jobs\\MyCustomHandler@handle',
    'arn:aws:sns:us-east-1:012345667910:my-other-sns-topic-name' => 'App\\Jobs\\AnotherCustomHandler@handle',

];

Create a corresponding Laravel Job class to handle the payload:, (*11)

<?php namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;

class MyCustomHandler extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    public function handle($sqs_job, $payload)
    {

        $this->setJob($sqs_job);

        // Process the job here.

        $this->delete();

    }

}

Contributors

Nathan Kirschbaum, (*12)

Alfred Nutile, (*13)

The Versions

10/06 2016

dev-master

9999999-dev

A Laravel package that allows the queueing system to deal with the non-laravel payload when subscribed to an AWS SNS topic.

  Sources   Download

The Requires

 

The Development Requires

by Nathan Kirschbaum

aws-sns-payload laravel-queue custom-payload

10/06 2016

v1.0.0

1.0.0.0

A Laravel package that allows the queueing system to deal with the non-laravel payload when subscribed to an AWS SNS topic.

  Sources   Download

The Requires

 

The Development Requires

by Nathan Kirschbaum

aws-sns-payload laravel-queue custom-payload