Creating a queue and using Artisan to run it
There may be times when our app is required to do a lot of work behind the scenes to accomplish a task. Instead of making a user wait until the tasks are complete, we can add them to a queue and do the processing later. There are many queue systems available but Laravel has a few that are very easy to implement. In this recipe, we'll be using IronMQ.
Getting ready
For this recipe, we'll need a working installation of Laravel 4, as well as API credentials for IronMQ. A free account can be created at http://www.iron.io/.
How to do it...
To complete this recipe, follow the given steps:
In the
app/config
directory, open thequeue.php
file, set the default value toiron
and fill in the credentials from IronMQ.Open Laravel's
composer.json
file and update the required section so it looks resembles the following snippet:"require": { "laravel/framework": "4.0.*", "iron-io/iron_mq": "dev-master" }
In the command line window, update the composer file with the...