Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Run Queues & Configure Laravel ENV for Amazon SQS

I'm having trouble working with Amazons SQS within my Laravel 5.2 app. My app queued events work fine when i use database queue drivers, but not when I use sqs

I think I'm probably not passing Amazons credentials properly. Here my set up from my ENV file

I've installed aws/aws-sdk-php

   QUEUE_DRIVER=sqs

   SQS_PUBLIC_KEY=PUBLICKEY
   SQS_SECRET_KEY=SECRETKEY
   SQS_PREFIX=https://sqs.us-west-2.amazonaws.com/NUMBER
   SQS_QUEUE=QUE 

my config/queue looks like this:

'sqs' => [
        'driver' => 'sqs',
        'key'    => env('SQS_PUBLIC_KEY'),
        'secret' => env('SQS_SECRET_KEY'),
        'prefix' => env('SQS_PREFIX'),
        'queue'  => env('SQS_QUEUE'),
        'region' => 'us-east-1',
    ],

any guidance would be greatly appreciated

like image 442
Luna Avatar asked Feb 21 '17 22:02

Luna


People also ask

What is a queue job?

A job queue contains an ordered list of jobs waiting to be processed by a subsystem. The job queue is the first place that a submitted batch job goes before becoming active in a subsystem. The job is held here until a number of factors are met.

How do Laravel queues work?

Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database. Queues allow you to defer the processing of a time consuming task, such as sending an email, until a later time.

What is queue in Laravel with example?

Laravel queues provide a unified queueing API across a variety of different queue backends, such as Amazon SQS, Redis, or even a relational database. Laravel's queue configuration options are stored in your application's config/queue.php configuration file.


1 Answers

In your config/queue.php file, make sure you have the ENV values listed.

Something like this:

'sqs' => [
    'driver' => 'sqs',
    'key'    => env('SQS_PUBLIC_KEY'),
    'secret' => env('SQS_SECRET_KEY'),
    'queue'  => env('SQS_PREFIX'),
    'region' => env('SQS_REGION'),
],
like image 154
Mike Barwick Avatar answered Oct 02 '22 13:10

Mike Barwick