06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Queues<br />

• Introduction<br />

• Writing Job Classes A> - Generating Job Classes A> - Job Class Structure<br />

• Pushing Jobs Onto The Queue A> - Delayed Jobs A> - Job Events<br />

• Running The Queue Listener A> - Supervisor Configuration A> - Daemon Queue Listener A><br />

- Deploying With Daemon Queue Listeners<br />

• Dealing With Failed Jobs A> - Failed Job Events A> - Retrying Failed Jobs<br />

Introduction<br />

The Laravel queue service provides a unified API across a variety of different queue back-ends.<br />

Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until<br />

a later time which drastically speeds up web requests to your application.<br />

Configuration<br />

The queue configuration file is stored in config/queue.php. In this file you will find connection<br />

configurations for each of the queue drivers that are included with the framework, which includes<br />

a database, Beanstalkd¹⁹⁶, Amazon SQS¹⁹⁷, Redis¹⁹⁸, and synchronous (for local use) driver.<br />

A null queue driver is also included which simply discards queued jobs.<br />

Driver Prerequisites<br />

Database<br />

In order to use the database queue driver, you will need a database table to hold the jobs. To generate<br />

a migration that creates this table, run the queue:table Artisan command. Once the migration is<br />

created, you may migrate your database using the migrate command:<br />

¹⁹⁶http://kr.github.com/beanstalkd<br />

¹⁹⁷http://aws.amazon.com/sqs<br />

¹⁹⁸http://redis.io<br />

419

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!