File based queue for laravel 4.1.x
A simple queue implementation for laravel 4 that works with the filesystem. This can be used during development or when performance is not a concern (such as interacting with intermittent third party services).
- File based storage of queued jobs.
- Uses built-in json_encode and json_decode for job storage.
- Works with closures as well as classes.
- Automatic retry logic on a dynamically increasing delay.
Simply add FileQueue to your
You'll then need to run
composer install to download it and have the class autoloader updated.
After composer has installed FileQueue you will need to add the service provider. Edit
app/config/app.php and updated the
'providers' => array( // Existing providers... 'Mcpruitt\FileQueue\FileQueueServiceProvider', )
Finally you'll need to add the new queue to your
app/config/queue.php and add a new entry to your
connections array specifying the
'file' => array( 'driver' => 'file' )
You can now use your queue like normal.
driver - This is the driver for the queue. This should be set to
directory - (default:
storage\FileQueue) - This is the directory where job files should be stored.
default) - This is the name of the default queue to place jobs under.
false) - If
true exceptions that are thrown when a job is fired will be allowed to bubble up. If
false exceptions will be caught and logged and the job will be released (with an incremented attempt count).
'file' => array( 'driver' => 'file', 'directory' => null, 'defaultqueue' => 'default', 'bubbleexceptions' => false )
By default the queue stores its job files in the
storage\FileQueue folder. This folder can be overridden by specifying the
directory option when configuring the queue. Within this directory another folder will be created for each queue name encountered (i.e. default). Within the name folder an inprocess folder will be created which holds jobs out of the standard queue folder while they are being processed.
Job files are named in a uniform manner: