Laravel Montréal #4 - November 27th, 2014
Thanks for comming !
Sponsors
Jobs
Get involved
Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application.
Think of a queue as a to do list
It offers 4 different drivers, one simple API
php artisan queue:listen
php artisan queue:listen --timeout=60
php artisan queue:listen --timeout=60 --tries=3
php artisan queue:failed-table
php artisan queue:failed
php artisan queue:retry 1
php artisan queue:forget 1
php artisan queue:flush
# Debian / Ubuntu:
# already installed in homestead
$ sudo apt-get install supervisor
# Debian / Ubuntu:
# already installed in homestead
$ sudo nano /etc/supervisor/conf.d/myqueue.conf
[program:myqueue]
command=php artisan queue:listen --tries=3
directory=/home/vagrant/Code/queue
stdout_logfile=/home/vagrant/Code/queue/app/storage/logs/myqueue_supervisord.log
redirect_stderr=true
autostart=true
autorestart=true
$ sudo supervisorctl
> reread # Tell supervisord to check for new items in /etc/supervisor/conf.d/
> add myqueue # Add this process to Supervisord
> start myqueue # May say "already started"
php artisan queue:subscribe queue_name http://queue.app/queue/receive
Route::post('queue/receive', function()
{
return Queue::marshal();
});