Thiago Valente
Thiago Valente

Reputation: 703

Laravel Queue with AWS Elastic Beanstalk

In my local server I can use the queue without problem, just using: php artisan queue:work.

But in my server in AWS the queue don't running.

My connection queue is database and sync mails are sending without problem.

I'd checked in Job table and I can see my queues but for unknown reason it's never running.

Is necessary to do some different configuration in AWS Elastic Beanstalke server?

I've tried to use manually

php artisan queue:listen
php artisan queue:work

Both failed.

Upvotes: 2

Views: 4163

Answers (1)

Manpreet
Manpreet

Reputation: 2620

Things to check:

  1. Try specifying the connection name: php artisan queue:work database

  2. Else make sure your env file on EC2 refers to correct default QUEUE_DRIVER QUEUE_DRIVER=database in this case

  3. Check config/queue.php for right default settings, if you don't specify queue driver in env file default' => env('QUEUE_DRIVER', 'database')

  4. Run php artisan config:cache on your EC2 instance for reload the env changes.

And you only need to use only one of the 2 commands, recommended is php artisan queue:work as its caches application state but run php artisan queue:restart every time you push code changes.

It is recommended to install and configure supervisor: https://laravel.com/docs/5.8/queues#supervisor-configuration

It will take care of restarting the queue worker on EC2 restart or queue failure

Upvotes: 5

Related Questions