Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Queue with Amazon SQS

Hi I am new in laravel 4, getting trouble while configuring AWS SQS in my local machine. I need to push some jobs in the AWS queue and execute them sequentially.

I have set the required values in app/config/queue.php

 'sqs' => array(
     'driver' => 'sqs',
     'key'    => 'XXXXXX',
      'secret' => 'XXXXXX',
      'queue'  => 'https://sqs.us-west-2.amazonaws.com/XXXXXX/myqueue',
      'region' => 'us-west-2',
   ),

and have also override the queue value in app/config/local/queue.php

$queue = include __DIR__ . "/../queue.php";
$queue['connections']['sqs']['queue'] = 'https://sqs.us-west-2.amazonaws.com/XXXXXXX/mylocalqueue';
return $queue;

Also I have changed updated the bootstrap/start.php to set the environment as local

<?php
$env = $app->detectEnvironment(array(
'local' => array('my-machine-name'),
));

I have pushed the jobs in queue in the controller function as following

public function pus_aws($data){
    $queue = $this->app['queue'];
    $queue->push('\ControllerName@ActionName', array(
        'data' => $data,
    ));

    return true;
}

But it is not working. Can anybody please help me to push and run the queued jobs?

like image 974
Prosenjit Avatar asked Feb 22 '14 06:02

Prosenjit


1 Answers

Are you listening on the queue?

php artisan queue:listen --env=your_environment

http://laravel.com/docs/queues#running-the-queue-listener

For Production-Setup, you should use supervisor as stated in the Laravel Docs.

See this for a tutorial (uses beanstalkd, but is the same for sqs, only that you do not have to install beanstalkd) http://fideloper.com/ubuntu-beanstalkd-and-laravel4

like image 104
Slue Avatar answered Sep 18 '22 07:09

Slue